Can I have two different y axis for the same dataset?

INTRODUCTION:
I need to create a plot of the noise performance of the readout electronics for a radiation detector, with respect to a circuit-related parameter called "peaking time".
In our scientific community, some people express this noise in term of "ENC" (equivalent noise charge), others in term of "FWHM" (full width at half maximum of a gaussian, in electron-volt).
So, the same noise performance can be expressed with two different numbers. There is a univocal relationship (non-linear) between ENC and FWHM.
QUESTION:
In my case I therefore wish to have a single plot, where on the x-axis I plot a parameter called "peaking time" and on the y-axis I plot the noise performance. I want to to have the ENC ticks on the left y axis, and the FWHM ticks on the right y axis. Note: I do not want to have two plotted curves, just one.
Any suggestion on how to do this?
Thank you very much
Paolo

Answers (1)

Adam Danz
Adam Danz on 1 Dec 2018
Edited: Adam Danz on 1 Dec 2018

2 Comments

Dear Adam,
this does not seem correct.
From my understanding, the yyaxis allows to plot two different data sets on the same figure.
But I do not want to have two plotted curves, just one.
I want something like this:
http://i.stack.imgur.com/88llX.gif
You can use yyaxis to do what you're describing. You don't need to plot a 2nd set of data. Just use the right axis for scaling and setting the y ticks you want. Here's an example.
x = 1:10;
y = log(x);
plot(x,y, '-o')
h = gca;
yyaxis left
set(h, 'YTick', [0 : .5 : 3], 'ylim', [0, 3])
leftColor = h.YAxis.Color;
yyaxis right
set(gca, 'YTick', [0 : .25: 1], 'ylim', [0, 1])
h.YAxis(2).Color = leftColor;

Sign in to comment.

Tags

Asked:

on 1 Dec 2018

Commented:

on 1 Dec 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!