I have a 2d plot, where I'm plotting units in nm on the x-axis. I want
to calculate the corresponding electron-volt value, and display this
value on the x axis on top of the plot. How can I do this? I am
attempting to plot both datasets (which has the exact same spots in
the graph), and have both eV and nm scaling show in the figure, one on
top, and one below the plot area.. how can I do this?
|
|
0
|
|
|
|
Reply
|
jon.skarpeteig (2)
|
11/19/2009 11:12:33 AM |
|
Jon <jon.skarpeteig@gmail.com> wrote in message <0d4f5212-09e2-4e17-87ab-ad5563c152e6@d21g2000yqn.googlegroups.com>...
> I have a 2d plot, where I'm plotting units in nm on the x-axis. I want
> to calculate the corresponding electron-volt value, and display this
> value on the x axis on top of the plot. How can I do this? I am
> attempting to plot both datasets (which has the exact same spots in
> the graph), and have both eV and nm scaling show in the figure, one on
> top, and one below the plot area.. how can I do this?
Hi Jon, here is one way, plotting a cosine with seconds on the bottom x-axis and milliseconds on the top x-axis.
t =0:(1/Fs):0.1; %seconds
t1 = t.*1000; % msec
Fs = 1000;
hLine1 = line(t,y,'color','k');
Ax1 = gca;
Ax2 = axes('Position',get(Ax1,'Position'),...
'XAxisLocation','top');
hLine2 = line(t1,y,'color','k','parent',Ax2);
Hope that helps,
Wayne
|
|
0
|
|
|
|
Reply
|
Wayne
|
11/19/2009 12:53:06 PM
|
|
"Wayne King" <wmkingty@gmail.com> wrote in message <he3f3i$cb4$1@fred.mathworks.com>...
> Jon <jon.skarpeteig@gmail.com> wrote in message <0d4f5212-09e2-4e17-87ab-ad5563c152e6@d21g2000yqn.googlegroups.com>...
> > I have a 2d plot, where I'm plotting units in nm on the x-axis. I want
> > to calculate the corresponding electron-volt value, and display this
> > value on the x axis on top of the plot. How can I do this? I am
> > attempting to plot both datasets (which has the exact same spots in
> > the graph), and have both eV and nm scaling show in the figure, one on
> > top, and one below the plot area.. how can I do this?
>
> Hi Jon, here is one way, plotting a cosine with seconds on the bottom x-axis and milliseconds on the top x-axis.
>
> t =0:(1/Fs):0.1; %seconds
> t1 = t.*1000; % msec
> Fs = 1000;
> hLine1 = line(t,y,'color','k');
> Ax1 = gca;
> Ax2 = axes('Position',get(Ax1,'Position'),...
> 'XAxisLocation','top');
> hLine2 = line(t1,y,'color','k','parent',Ax2);
>
> Hope that helps,
> Wayne
Sorry Jon, I noticed that I forgot to paste in the cosine, and to declare Fs before constructing the time vector:
Fs = 1000;
t =0:(1/Fs):0.1; %seconds
t1 = t.*1000; % msec
y = cos(2*pi*100*t);
hLine1 = line(t,y,'color','k');
Ax1 = gca;
Ax2 = axes('Position',get(Ax1,'Position'),...
'XAxisLocation','top');
hLine2 = line(t1,y,'color','k','parent',Ax2);
Wayne
|
|
0
|
|
|
|
Reply
|
Wayne
|
11/19/2009 2:41:22 PM
|
|
|
2 Replies
2650 Views
(page loaded in 0.034 seconds)
Similiar Articles: How to create a second x-axis on top of plot? - comp.soft-sys ...I have a 2d plot, where I'm plotting units in nm on the x-axis. I want to calculate the corresponding electron-volt value, and display this value on the x axis on top ... Plotting two functions on the same plot - comp.soft-sys.matlab ...How to create a second x-axis on top of plot? - comp.soft-sys ... I have a 2d plot, where I'm plotting units in nm on the x-axis. I want to ... I am attempting to plot ... Flipping the y-axis? - comp.soft-sys.matlabHow to create a second x-axis on top of plot? - comp.soft-sys ... That is, have the x-axis at the top ... selecting specific rows of a data file for a 2D plot - comp.soft ... Plots with vertical x axes - comp.soft-sys.matlabHow to create a second x-axis on top of plot? - comp.soft-sys ... errorbar on x and y axis - comp.soft-sys.matlab Plots with vertical x axes - comp.soft-sys.matlab How do ... How to generate a 2D intensity plot - comp.soft-sys.matlab ...How to create a second x-axis on top of plot? - comp.soft-sys ... I have a 2d plot, where I'm plotting units in nm on the x-axis. I want to calculate the corresponding ... how to plot histograms on - comp.soft-sys.matlabtop of each other? I have two vectors, and I would like to plot two ... the x axis; for separation on the y axis, you would add a constant to the y values for the second ... random# histogram with gaussian overlay - comp.soft-sys.matlab ...How to create a second x-axis on top of plot? - comp.soft-sys ... random# histogram with gaussian overlay - comp.soft-sys.matlab ... Set the axes to run from -4 to +4 on ... Axes Label Question - comp.soft-sys.matlabHow to create a second x-axis on top of plot? - comp.soft-sys ..... hLine1 = line(t,y,'color','k'); Ax1 = gca; Ax2 = axes ... Bar chart double y axis question - comp ... Break y-axis - comp.soft-sys.matlab... in ML on a single axis; either use plotyy or make a second axis ... graph - comp.soft-sys.matlab plot scroll bars, x-axis spacing - comp.soft-sys.matlab 3 y axis plot ... Displaying curvature continuous edges in drawings? - comp.cad ...How to create a second x-axis on top of plot? - comp.soft-sys ..... the corresponding electron-volt value, and display this ... plot graph draw a line from x-axis ... How to create a second x-axis on top of plot? - comp.soft-sys ...I have a 2d plot, where I'm plotting units in nm on the x-axis. I want to calculate the corresponding electron-volt value, and display this value on the x axis on top ... How to Make a Scatter Plot | eHow.comPlace the second data point (2, 19), in the ... from the left endpoint of the x-axis to 1 inch from the top edge ... Do a Scatter Plot on MS Office; How to Make an X-Y Scatter Plot ... 7/19/2012 7:13:32 PM
|