Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8593791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:04:14+00:00 2026-06-12T00:04:14+00:00

Final edit: Result using matplot() I’ll see to it that I work with ~3

  • 0

Final edit: Result using matplot()
I’ll see to it that I work with ~3 digit values to get a more distinctive result, but basically it’s what I wanted
enter image description here

Original Question


I want to create a graph that should look like the attached image graph should look like this

What I got are the values for each line (representing a different topic) for both the y and x axis.

Close to an example on R plotting I found, I tried the following:

arts=c(pt[1,])
g_range <- range(0, arts)
plot(arts, type="o", col="blue", ylim=g_range,axes=FALSE, ann=FALSE)
axis(1, at=1:23, lab=c(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23))
box()

This results in the error

Error in xy.coords(x, y, xlabel, ylabel, log) :
‘x’ is a list, but does not have components ‘x’ and ‘y’

So apparently arts is not the right parameter for plot here, right?
Sidenote: the values in the arts vector are ordered to fit the 0-23 scale

In addition: this is what the head of pt looks like enter image description here

Edit: on request, here the output of dput(head(pt))

    structure(list(`0` = c(2, 1, 0, 0, 0, 0), `1` = c(1, 0, 0, 0, 
0, 0), `2` = c(1, 0, 0, 0, 0, 0), `3` = c(0, 0, 0, 0, 0, 0), 
    `4` = c(0, 0, 0, 0, 0, 0), `5` = c(0, 0, 0, 0, 0, 0), `6` = c(1, 
    0, 0, 0, 0, 0), `7` = c(1, 0, 0, 0, 0, 0), `8` = c(1, 0, 
    0, 0, 0, 0), `9` = c(2, 0, 0, 0, 0, 0), `10` = c(2, 1, 0, 
    0, 0, 0), `11` = c(2, 1, 0, 0, 0, 0), `12` = c(2, 1, 0, 0, 
    0, 0), `13` = c(2, 1, 0, 0, 0, 0), `14` = c(2, 1, 0, 0, 0, 
    0), `15` = c(3, 1, 0, 0, 0, 0), `16` = c(3, 1, 0, 0, 0, 0
    ), `17` = c(3, 1, 0, 0, 0, 0), `18` = c(3, 1, 1, 1, 0, 0), 
    `19` = c(3, 1, 1, 1, 0, 0), `20` = c(3, 1, 1, 1, 0, 0), `21` = c(3, 
    1, 1, 1, 0, 0), `22` = c(3, 1, 1, 0, 0, 0), `23` = c(2, 1, 
    0, 0, 0, 0)), .Names = c("0", "1", "2", "3", "4", "5", "6", 
"7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", 
"18", "19", "20", "21", "22", "23"), row.names = c(NA, 6L), class = "data.frame")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T00:04:16+00:00Added an answer on June 12, 2026 at 12:04 am

    matplot can be used to plot each column of a matrix as a separate line in a figure. You just need to transpose the matrix and you are all set. For details on the arguments to matplot see ?matplot and ?par that controls general graphics parameters.

    # Generate data
    categories <- c("Entertainment", "Games", "Health", "Personal Finance",
        "Shopping", "Music", "USSites", "Porn")
    colors <- c("green", "blue", "cyan", "yellow", "magenta", "orange",
        "red", "black")
    markers <- 1:8
    pt <- matrix(runif(length(categories)*23), length(categories), 23)
    
    # Plot
    matplot(1:23, t(pt), type="l", col=colors, lty=1, pch=markers,
            bty="n", las=1, main="Categorical Percent over Time")
    legend("topright", col=colors, categories, bg="white", lwd=1, pch=markers)
    

    enter image description here

    It looks terribly messy since I just sampled uniformly distributed random data, but it will look much better with yours.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

FINAL EDIT: After following the answer from Darin Dimitrov, I have found that the
edit: I use version 1.6.8 of jOOQ; in newer versions this should work (see
I'm using the facebook sdk 3.0 It is easy to install , but I
I have a query that will return results from 2 tables into 1 using
Nimbus often looks great, but for certain color combinations the result is non-optimal. In
I'm using Assetic to include Javascript files, but when used in the dev environment,
My problem is that the first, and final list of triangles are not being
I am building an iPhone application that will be using a weighted graph (probably
I have a problem with hashCode() that delegates to uninitialized objects using hibernate. My
The Java static compiler (javac) inlines some static final variables and brings the values

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.