plot 2 graph in one figure with same axis

  • Permalink
  • submit to reddit
  • Email
  • Follow


Hallo my name is Dalle,

i'm really new to Matlab, and in my semester project i have to really use a load amount of Matlab so i really need to get used to it right now..
can someone tell me how to solve this:
1. i have a histogram in the first figure and response curve in another figure... the y-axis from the histogram is the same with the x-axis from the response curve... how do i plot both of them in one figure, with y-axis from the histogram and the x-axis from the respose curve being the same axis for the new figure?

2. i have plot a histogram from an image, but it only shows in 16-bit (65536 gray value), but i really like to show the histogram in 12-bit (4096 gray value).. is there any re-scale function in matlab for histogram?

thank you so much for your help in advance ;)

cheers!
Dalle
0
Reply Dalle 4/26/2010 1:50:26 PM

See related articles to this posting

Dalle
1. plot using bar() and plot() with "hold on" in between them.  Or
maybe you want plotyy() if they're both going to be line plots.

2.  Not exactly sure what you're saying but you can pass in the number
of bins into hist and imhist.  And you can also set the max along the
x axis using xlim().  One of those should do the trick for you.



0
Reply ImageAnalyst 4/26/2010 11:22:31 PM


ImageAnalyst <imageanalyst@mailinator.com> wrote in message <df3666e2-6678-42cb-aa58-83b7921c288c@s41g2000vba.googlegroups.com>...
> Dalle
> 1. plot using bar() and plot() with "hold on" in between them.  Or
> maybe you want plotyy() if they're both going to be line plots.
> 
> 2.  Not exactly sure what you're saying but you can pass in the number
> of bins into hist and imhist.  And you can also set the max along the
> x axis using xlim().  One of those should do the trick for you.
> 
> 

thank you so much ImageAnalyst, the first problem is solved :D
hmm but i still can't figure out with the second problem... i mean first i read an image with f = imread('....')
and then with imhist(f) i plot it's histogram
but the automatic histogram wiill produced 6x10^4 in this case 65536 value (16-bit) for the x-axis... i know that in Matlab we can store images just in 8-bit and 16-bit... but what i want is just to plot a histogram (from an 16-bit image) with 12-bit (4096 gray value) for the x-axis... i thought about dividing all of the matrix from the images with 16 coz 655536 / 16 = 4096, but when i plot the histogram for the new matrix, it doesn't matched with the previous histogram..
i hope i don't being a completely newbie about image processing :p
0
Reply Dalle 4/27/2010 11:39:05 AM
comp.soft-sys.matlab 201069 articles. 512 followers. Post

2 Replies
285 Views

Similar Articles

[PageSpeed] 12


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Plot two graphs on same figure with two x-axes and one shared y-axis
I just wanted to plot two different functions, for simplicity let's say: 1. price in USA; and 2. price in India, as a function of weight. Now, I want this weight to be represented in pounds (popular in USA) as well as kilograms (popular in India), as two different x-axes, one on top of the graph while another on bottom of the graph. However, I want only single y-axis to compare the graphs of 'price in USA' and 'price in India'. Is that possible in Matlab? I tried plotyy but it creates two y-axes for a single x-axis. Any help is greatly appreciated. Thanks. ...

one scatter plot with 2 x axis and 2 y axis, one of the x axis being a function of the first x axis
Hello to all! I'm trying to do a Hertzsprung-Russell diagram like this one: http://en.wikipedia.org/wiki/File:HRDiagram.png If you see, the temperature (top x axis) is not a linear function of the color (bottom x axis), and i cant find a way to do this. My code: % to read the stars data: filename = 'Hipparcos_stars2.xlsx'; sheet1 = 1; xHRcolor = 'G2:G19934'; yHRmag = 'I2:I19934'; xHRtemp = 'J2:J19934'; yHRlum = 'K2:K19934'; HRx_c = xlsread(filename, sheet1, xHRcolor); HRy_m = xlsread(filename, sheet1, yHRmag); HRx_t = 10.^(3.9396...

2 y-axis plots on one plot
All, I have 2 functions that share the same domain but have different ranges e.g. f1(x) = function that outputs magnetic field (gauss) f2(x) = function that outputs size (meters) .. I've seen graphs where the left vertical axis is for one function, and the right vertical axis is for the other. The domain (horizontal) axis is the same for both. Is there a nice way to do this in Matlab? Thanks! On Jun 1, 3:41=A0pm, olsonaj <Abraham.Ol...@gmail.com> wrote: > All, > > I have 2 functions that share the same domain but have different > ranges > > e.g. > > f1(...

Putting 2 graphs from 2 different m files into one plot
Hello, I have some m Files (4 to be exact) each generates a semilog graph. I want all 4 curves to appear on the same semilog graph I cant just put all the code in one file because there are alot of common variables. Thanks "Shadi Philip" <shadi.phi@hotmail.com> wrote in message <gubv1p$aum$1@fred.mathworks.com>... > Hello, > > I have some m Files (4 to be exact) each generates a semilog graph. > I want all 4 curves to appear on the same semilog graph > > I cant just put all the code in one file because there are alot of common variables. > >...

2 plot in one figure?
Hi folks; I am trying to plot 2 figures in one figure. In MATLAB we have a function named POLYY and we can plot 2 figures (2 Y) in one figure. I want to plot this 2 plot in one figure in IDL whit different scale first one is ordinary and second one logarithmic. Thanks for any help in advance. Cheers Dav On Nov 28, 8:09 am, d.po...@gmail.com wrote: > Hi folks; > I am trying to plot 2 figures in one figure. In MATLAB we have a > function named POLYY and we can plot 2 figures (2 Y) in one figure. I > want to plot this 2 plot in one figure in IDL whit different scale > first one is...

2 plots in one figure
Hi, I'm a beginner in matlab... can you tell me how to put a scatter plot and function plot into one figure? Thanks ushy wrote: > > > Hi, I'm a beginner in matlab... can you tell me how to put a > scatter > plot and function plot into one figure? Thanks Try the following help plotyy rf ushy wrote: > Hi, I'm a beginner in matlab... can you tell me how to put a scatter > plot and function plot into one figure? Thanks Use % first plot hold on; % second plot HTH -rajeev- Try the following: figure hold on; grid on; plot(xs,yx,'bx') p...

2 Graphs in one plot
Hi, I want to plot 2 graphs (that depends on the same variable) in one plot but with different scales for y, so plot "plot1", "plot2" is not possible. The scales should appear on the left an right side of the plot. To explain what I want to do, here is a small example: set multiplot set border 3 set xtics nomirror set ytics nomirror plot [0:10] sin(x) set logscale y2 unset ytics set y2tics border nomirror set border 9 plot [0:10] log(x) unset multiplot pause -1 The problem is, that the x-axis is not syncronized, because, the axis labels are on dif...

two plots in one figure #2
Dear Firends, Sometimes i see a graph made by Matlabe that contains two plots((This is not a subplot figure!)) by which i mean they opened a figure; then they plot some data, and the put a specific rage of data, let say zoom in a specific part of graph, as a individual graph in the corner of figure! Do you have any idea, how it possible? Thanks "karlo gonzales": <SNIP plot-in-plot... one of the many solutions % the big guy plot(rand(1,10)); % the little guy axes('position',[.5,.5,.3,.3]); line(1:10,rand(1,10)); box on; us ...

plotting 2 curves in one figure
hello all i know I can use the hold on / all to plot 2 plots in one figure. but what if I have a pre-defined function that plot for me. and the thing is that each time it is plotting it plots it on a new figure. is the ea way to plot it on a the same figure? the function is: function SpectrumAnalyzer(InputArray,Fs) Yaxis=abs(fftshift(fft(InputArray))); Yaxis=Yaxis.*Yaxis; v=size(Yaxis); if v(1)==1 V=size(Yaxis,2); Xaxis=-Fs/2+Fs/V:Fs/V:(Fs/2); else V=v(1); Xaxis=-Fs/2+Fs/V:Fs/V:(Fs/2); Xaxis=Xaxis.'; end Yaxis=10*log10(Yaxis*4/(V.*V)); % figure ------------> i actually chan...