Message Boards Message Boards

0
|
9394 Views
|
5 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Labeling Two PLot Axis

Hi,

I have been using TwoPlotAxis Initialization that was provided, however I have two problem.

  1. I could not find any suitable ways to include labeling of the graph on x-axis and both y-axis.
  2. Is there any ways to rescale the y-axis on the right side to make it appears as the range in the left side of the y-axis?

    Thanks,

Syed

Attachments:
5 Replies

Hi Syed,

I hope this will help. Please find attached the updated code.

Cheers.....Jos

Attachments:
POSTED BY: Jos Klaps

Hi Jos,

Thanks a lot. It work!

Hi,

Is there any way that I can re-scale the axis on the right side of the two-plot axis to not include any decimal place and, perhaps, sharing the same level of origin value to the left side of the plot?

Thanks

Posted 9 years ago

good

POSTED BY: Harry Potter

Hi Muhammad,

Probably this will help: make 'plot 1 + plot 2 and use Overlay'.

See example and details in file attached.

(* Step 1: make a plot with Ticks on y1 and Frame *)
p1 = Plot[Sin[x], {x, 0, 10}
   , Frame -> {{True, None}, {True, True}}
   , FrameTicks -> {{Automatic}, {{-0.9, "-1"}, {-0.5, "-0.5"}, {0, 
       "0"}, {0.5, "0.5"}, {0.9, "1"}}}
   , FrameStyle -> Automatic
   , FrameTicksStyle -> {{None, 
      Red}, {Directive[FontColor -> Gray, White], None}}
   , PlotRangePadding -> 0
   , ImagePadding -> 35
   ];

(*Step 2: make a the same plot with Ticks on y2 and Frame *)
p2 = Plot[Sin[x], {x, 0, 10}
  , Frame -> {{None, True}, {None, None}}
  , FrameTicks -> {{{-0.9, "1"}, {-0.5, "2"}, {0, "3"}, {0.5, 
      "4"}, {0.9, "5"}}, {Automatic, Automatic}}
  , FrameStyle -> Automatic
  , FrameTicksStyle -> {{None, 
     Red}, {Directive[FontColor -> Gray, White], None}}
  , PlotRangePadding -> 0
  , ImagePadding -> 35
  ]

(*Step 3: Overlay Plot 1 and Plot 2 *)
Overlay[{p1, p2}]
Attachments:
POSTED BY: Jos Klaps
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract