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 201581 articles. 514 followers. Post

2 Replies
292 Views

Similar Articles

[PageSpeed] 22

  • 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...

PLOT two graphs in one figure?
Hi, Does anyone know of a way to plot two vectors in one figure so that one plot is on top of the other? One plot could be blue, and the other could be red so that it's easy to distinguish between the two. Thanks in advance! In article <g534r5$eto$1@fred.mathworks.com>, Jack Branning <jbr.nospam@nospam.com> wrote: >Does anyone know of a way to plot two vectors in one figure so that one plot is >on top of the other? One plot could be blue, and the other could be red so that >it's easy to distinguish between the two. plot(x1,y1,'b',x2,y2,'r'...

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 data
Hello, I'm a new user to matlab and I would like to write a script for plotting data like in figure 2, but without the line between the subplots (see link below). Currently I manage to get figure 1. Can anyone help me with this ? Thanks a lot. Vincent. <http://www.evavincent.be/mlab/1.tif> <http://www.evavincent.be/mlab/2.tif> A simple (but not elagent) solution would seem to be to use 'hold on;' command to plot the two graphs in the same figure. You can just add an offset to the graph above to get it to look at 2.tif Then to get rid of y axis labels use 'set(gca...

how to Plot 3 graph in one figure
Hi I need your help, and your help would be really appreciated. Thanks. I ran in to a problem, I need to plot a graph with the below features. I have a series of X data and corresponding to these Xs, I have 3 series of Ys. I have to plot these data which would be 3 graphs in just a single Figure. So I need a command in MATLAB which can plot 3 graphs with 3 different scales in a single figure. On the other hand, I need those y axes in the logarithmic scale.The x axis is in the linear scale. any idea would be ok... here is a sample picture: http://i741.photobucket.com/albums...

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...

Handling 2 Graphs in one figure
Hi all, I have created 2 graphs(linear lines) on 1 figure. I need to mark the area between the lines. Is there a function that can do it? Thanks, Jon. Hi! You could do it like this: %first graph area(1:10, 1:10, 'facecolor', 'b'); hold on; %second graph area(1:10, 0.5:0.5:5, 'facecolor', 'w'); Konstantin Jon wrote: > Hi all, > > I have created 2 graphs(linear lines) on 1 figure. I need to mark the > area between the lines. > Is there a function that can do it? > > Thanks, > Jon. ...

plot more than one figures at the same time #2
Dear all, How can one draw more than one figure at the same batch session of the gnuplot? For instance, I would like to plot all of these figures at the same time: splot 'mode1_matrix.dat' matrix with pm3d #replot #splot 'mode2_matrix.dat' matrix with pm3d #replot #splot 'mode3_matrix.dat' matrix with pm3d #replot #splot 'mode4_matrix.dat' matrix with pm3d #replot #splot 'mode5_matrix.dat' matrix with pm3d #replot #splot 'mode6_matrix.dat' matrix with pm3d #replot #splot 'mode7_matrix.dat' matrix with pm3d #replot ...

plotting in matlab
hello, i have a probably very simple question, all i try to do is plotting multiple graphs that also have the same scale in one figure - but giving them different colour and caracter. i aditionally want to devide the graph at one point (lets say y=10) with a red line... i have the graphs as five (1,48) matix. and i would like to smothen the graph using something like spline... i have tried figuring this with matlab help - but it is out of my scope does anyone know an example that i can look at so i can figure how to code this??? this is my first contact with matlab and i am not too comforta...

basic question about plotting 2 functions in one graph
Hi, if I write something like this Plot[{3n, 2.6n}, {n, 0, 100000}] how can I distinguish them? How can I plot one of them green and one of them red (for example)? How can I write the function on the graph? THX Hi, Plot[{3n, 2.6n}, {n, 0, 100000}, PlotStyle -> {RGBColor[1, 0, 0], RGBColor[0, 1, 0]}, Epilog -> {{RGBColor[1, 0, 0], Text["Some curve", {20000, 250000}, {-1, 0}]}, {RGBColor[0, 1, 0], Text["Some other curve", {20000, 200000}, {-1, 0}]}} ] Regards Jens Ron Haus wrote: > > Hi, > if...

2 plots different sample points in one Graph
Hi, I am trying to draw 2 different Filter measurement&nbsp;outcome (insertion loss)&nbsp;on one graph. The 2 data have&nbsp;partly common sample frequency points. Both have varying not common&nbsp;frequency sample points (resolution)&nbsp;within the whole range. One has about 2100 sample points between 100 MHz-6GHz the other one about 1246 sample points between 120 MHz-6GHz How can I still make a graphically comparison between those two measurements and be confident? Maybe interpolation between the sample points? Thanks Yariv &nbsp; &nbsp; Hi Kenny, I have LV7.1. ...

Plotting 3 series for 2 groups in one graph.
Hi I would like to plot survival distribution and lower and upper CI for two groups (with treatment and without treatment) in one graph. Data are stored in one file with 4 variables (survival, lower, upper) and treatment=1 for the treated group and treatment=2 for the untreated group. How do I do that? I have been trying this: Proc gplot data=surv; Plot low*time=1 suvirval*time=2 upper*time=3/overlay; By treatment; Run; Quit; It generates two graphs and not one, because of by statement. If I use plot2 statement it is possible to plot low...

Plotting 3 series for 2 groups in one graph
/* Erik Christiansen asked: >From: Erik Christiansen <ec@SELVMORDSFORSKNING.DK> >Subject: Plotting 3 series for 2 groups in one graph. >Hi >I would like to plot survival distribution and lower and upper CI for two >groups (with treatment and without treatment) in one graph. Data are stored >in one file with 4 variables (survival, lower, upper) and treatment=1 for >the treated group and treatment=2 for the untreated group. How do I do that? >I have been trying this: >Proc gplot data=surv; > Plot low*time=1 suvirval*time=2 upper*time=3/overlay; > By ...

Re: plotting multiple curves on one graph #2
Syb it Here is the way that I would do this data have; input id prodb prodc; value = prodb; curve = 'ProdB'; output; value = prodc; curve = 'ProdC'; output; keep id value curve; datalines; 1 0 1 2 1 1 3 2 1 4 0 2 5 1 1 6 0 2 7 1 2 8 0 3 9 0 1 10 1 1 11 1 2 12 0 4 13 0 2 14 0 3 15 2 1 ;; run; Proc sort; by curve id; proc print data=have; run; Proc gplot; plot value * id = curve; symbol1 ...

Plotting a graph with one X-axis and two Y-axes
Hi, I am trying to create a graph with a single X-axis and two Y-axes corresponding to a width, height, and length of a rectangular box. I am trying to plot various combinations of these such that they correspond to the box volume of <40 cm3. In other words, I would like to print a graph such that someone can measure the sides of the box and look these up in the graph and know whether the volume is less than 40 cm3. I don't quite know how to implement this in Mathematica as I am pretty new at this. Thank you in advance for your help. Sincerely, Igor ...

Plotting two y axis in one graph with different scales
Though long research, I haven't been able to solve this problem I have. I hope some of you might be able. The problem should be simple, but since I am a novice at MATLAB, I cannot find the solution. I have two graphs which I would like to display in the same plot. These, however is not to be in the same scale on the y axis, so I need two y axis. The x axis have to be the same for the both though. I have come up with this code that almost contain the solution: close all clear all clc [x]=xlsread('1-spike.xlsx','B2:B3001'); %Tid [y1]=xlsread('1-spike.xls...

Re: Plotting 3 series for 2 groups in one graph.
You use the variable name on the right-hand side of the equal sign not the values. So your code should look like: symbol1 v=circle cv=red i=j; symbol2 v=circle cv=red i=j; symbol3 v=dot cv=blue i=j; plot low*time=treatment survival*time=treatment upper*time=treatment/overlay etc... quit; RVV ...

RE : basic question about plotting 2 functions in one graph
<< "Graphics`Colors`"; << "Graphics`Legend`"; Plot[{3*n, 2.6*n}, {n, 0, 100000}, PlotStyle -> {Green, Red}, PlotLegend -> {"3n", "2.6n"}, LegendPosition -> {1, 0}, ImageSize -> 500] Greetings F.Jaccard -----Message d'origine----- De�: Ron Haus [mailto:ronhaus@arcor.de] Envoy�: mercredi, 23. juin 2004 08:51 ��: mathgroup@smc.vnet.net Objet�: basic question about plotting 2 functions in one graph Hi, if I write something like this Plot[{3n, 2.6n}, {n, 0, 100000}] how can I distinguish them...