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 7942873
In Process

The Archive Base Latest Questions

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

I use the following R plot commands to create a plot – I managed

  • 0

I use the following R plot commands to create a plot – I managed to find the “right” commands after quite many look-ups in Google – but it is still not perfect:

x = c(0.1,0.2,0.3,0.4);

y = c(100,200,300,400);

z = c(81,82,83,87);

w = 150;

v = 85.5;

plot(x,y, type="l", lwd=4, xlab="threshold", ylab="seconds");

points(x, y, col="red", cex=2, pch=19);

abline(h=w, col="red", lwd=4);

par("usr");

par(usr = c(par("usr")[1:2], 80,90));

axis(4, lwd=4);

points(x, z, col="blue", cex=2, pch=19);

points(x, z, type="l", lwd=4);

abline(h=v, col="blue", lwd=4);

What I am looking for is a few things:

  1. adding a text next to the right y axis. I saw somewhere someone suggested using mtext, but it is not working for me. Isn’t there a way to have a label attached to the right y axis with the axis command? adding ylab or lab doesn’t help.

  2. I want the color of the text next to the y axis to be blue and red (so that it is clear, according to the dots in the graphs, which curve goes with which axis). Is that possible to color only the label of the y axis? (well, first I have to get a label for the right y axis!)

  3. I want to make the lines of the left y axis (and the tick marks) as thick as they are in the right y axis. Same for the x axis. Is that possible?

  • 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-04T00:06:22+00:00Added an answer on June 4, 2026 at 12:06 am

    Try something like this:

    par("mar")
    par(mar = c(par("mar")[1:3], 5.1))
    
    plot(x,y, type="n", lwd=4, ylab="", xlab="threshold", xaxt="n",yaxt="n")
    
    axis(1,lwd=4)
    axis(2,lwd=4)
    
    points(x, y, col="red", cex=2, pch=19)
    abline(h=w, col="red", lwd=4)
    
    par("usr")
    par(usr = c(par("usr")[1:2], 80,90))
    
    axis(4, lwd=4)
    points(x, z, col="blue", cex=2, pch=19)
    points(x, z, type="l", lwd=4)
    abline(h=v, col="blue", lwd=4)
    
    mtext("Your text", side = 4, col = "blue",line=3)
    mtext("seconds", side = 2, col = "red",line=3)
    

    enter image description here

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

Sidebar

Related Questions

I use following code: Create a retry policy, when error, retry after 1 second,
for example i use following command to find a record SELECT `users`.`mail` FROM `users`
I am plotting a graph using Core-Plot. When i use following code for x-axis
I am trying to use core-plot and I followed the instruction from the following
As question, I am trying to create a plot using the following code: chart.demo.sex.age
I'm trying to use following procedure in Delphi XE2 with Chromium component (version 306):
I'm trying to use following implementation of the ObservableDictionary: ObservableDictionary (C#) . When I'm
I would like to use following sql to avoid constructing sql dynamically: SELECT CommentID,
I have seen that in some cases we use following syntax format in c#,
I use VS2010, C# to develop Silverlight 4 app, I use following code in

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.