| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Dear all, I am trying to fit my data vector to a logarithmic colorbar. For the latter, I use the code suggested by David on the following link: http://www.dfanning.com/graphics_tips/logcb.html. Now, I have for example a vector X = [4.0, 0.04, 65.88, 3.62, 2.75, 7.04, 1.12,1.65] whereby my color bar ranges logarithmically from 0.001 to 100. So the colors for each of this vector point element fit my logarithmic color bar. I guess I should do something with the scale_vector function, or bytscl, but I can't seem to get it right?? I need to create a vector which contains a number (corresponding to an element of vector X) that I can use to extract the correct number referring to a color from the color bar. For each element, a box is filled with a specific color (here for I am using POLYFILL, so my image is not a continuum, but a chain of boxes, each with it's own color. Now, I need to get the color right following my logarithmic scale bar.... I hope this is clear and somebody can help me out? Cheers, Matthias |
|
#2
| |||
| |||
| maffie writes: > I am trying to fit my data vector to a logarithmic colorbar. For the > latter, I use the code suggested by David on the following link: > http://www.dfanning.com/graphics_tips/logcb.html. > > Now, I have for example a vector X = [4.0, 0.04, 65.88, 3.62, 2.75, > 7.04, 1.12,1.65] > whereby my color bar ranges logarithmically from 0.001 to 100. So the > colors for each of this vector point element fit my logarithmic color > bar. I guess I should do something with the scale_vector function, or > bytscl, but I can't seem to get it right?? > > I need to create a vector which contains a number (corresponding to an > element of vector X) that I can use to extract the correct number > referring to a color from the color bar. For each element, a box is > filled with a specific color (here for I am using POLYFILL, so my > image is not a continuum, but a chain of boxes, each with it's own > color. Now, I need to get the color right following my logarithmic > scale bar.... > > I hope this is clear and somebody can help me out? I think you want this: IDL> x = [4.0, 0.04, 65.88, 3.62, 2.75, 7.04, 1.12, 1.65] IDL> Print, BytScl(x, MIN=0.001, MAX=100) 10 0 168 9 7 18 2 4 Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/ Sepore ma de ni thui. ("Perhaps thou speakest truth.") |
|
#3
| |||
| |||
| Yes!! That's it! I worked my way around with a more complex For loop structure, but this is just perfect! That I couldn't think of that myself! Thank you David! Cheers! Oh, maybe one more question (although a bit off topic here): I have tried to used the "Axis" command, to plot my own defined X and Y axis. Yesterday, the axis were appearing on the plot, today, this command doesn't result in any axis appearing in my .eps figure? Any idea what could be the cause of this? Here is the short axis script: myticklen=-0.01 myticks1=['C','A','N','NE','E','SE','S','SW','W','NW'] mytickvals1=[X1+9.8, X1+(9.8*2), X1+(9.8*3), X1+(9.8*4), X1+(9.8*5), X1+(9.8*6), X1+(9.8*7), X1+(9.8*8), X1+(9.8*9), X1+(9.8*10)] AXIS, XAXIS=0, TICKLEN=myticklen,XTITLE='Title',$ XTICKS=9, XTICKNAME=myticks1, XTICKV=mytickvals1,color=255, CHARTHICK=3, CHARSIZE=1.3, YTICKV = findgen(N_ELEMENTS(Astd))+0.6 |
|
#4
| |||
| |||
| maffie writes: > Oh, maybe one more question (although a bit off topic here): > I have tried to used the "Axis" command, to plot my own defined X and > Y axis. Yesterday, the axis were appearing on the plot, today, this > command doesn't result in any axis appearing in my .eps figure? Any > idea what could be the cause of this? In general, you need to have set up a data coordinate system before you can use the AXIS command. I expect it is being drawn, but it is so tiny you can't see it. :-) I would try using a PLOT command with the /NODATA keyword set to draw your axes. The PLOT command will establish the data coordinate system for you. Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/ Sepore ma de ni thui. ("Perhaps thou speakest truth.") |
|
#5
| |||
| |||
| Hum, for some reason, things doesn't seem to work. I have added the Plot keyword as follows: PLOT, X, /nodata,/normal,POSITION=[0.14,0.57,1,0.58] But still I can't see any axis when putting the following after the keyword: myticklen=-0.01 myticks=['C','A','N','NE','E','SE','S','SW','W','NW'] myticks1=['P0','Rain','SWD','Tmax','Tmin','RH','F010','D010' ,'CC'] mytickvals=[X1+9.8, X1+(9.8*2), X1+(9.8*3), X1+(9.8*4), X1+(9.8*5), X1+(9.8*6), X1+(9.8*7), X1+(9.8*8), X1+(9.8*9), X1+(9.8*10)] mytickvals1=[0.1,0.3,0.6,0.8,0.9] AXIS, XAXIS=0,TICKLEN=myticklen,XTITLE='Weather type',$ XTICKS=9, XTICKNAME=myticks, XTICKV=mytickvals,color=black, CHARTHICK=3, CHARSIZE=1.3 AXIS, YAXIS=0, TICKLEN=myticklen,YTICKS=8, YTICKNAME=myticks1, YTICKV=mytickvals1,color=black,CHARTHICK=3, CHARSIZE=1.3 Any more ideas?? |
|
#6
| |||
| |||
| On Sep 8, 10:34*am, maffie <matthias.demuz...@geo.kuleuven.be> wrote: > Hum, for some reason, things doesn't seem to work. > > I have added the Plot keyword as follows: > > PLOT, X, /nodata,/normal,POSITION=[0.14,0.57,1,0.58] > > But still I can't see any axis when putting the following after the > keyword: > > myticklen=-0.01 > myticks=['C','A','N','NE','E','SE','S','SW','W','NW'] > myticks1=['P0','Rain','SWD','Tmax','Tmin','RH','F010','D010' ,'CC'] > mytickvals=[X1+9.8, X1+(9.8*2), X1+(9.8*3), X1+(9.8*4), X1+(9.8*5), > X1+(9.8*6), X1+(9.8*7), X1+(9.8*8), X1+(9.8*9), X1+(9.8*10)] > mytickvals1=[0.1,0.3,0.6,0.8,0.9] > AXIS, XAXIS=0,TICKLEN=myticklen,XTITLE='Weather type',$ > * * * * XTICKS=9, XTICKNAME=myticks, XTICKV=mytickvals,color=black, > CHARTHICK=3, CHARSIZE=1.3 > AXIS, YAXIS=0, TICKLEN=myticklen,YTICKS=8, YTICKNAME=myticks1, > YTICKV=mytickvals1,color=black,CHARTHICK=3, CHARSIZE=1.3 > > Any more ideas?? I'm guessing your background is white otherwise all those color=black will just make the axis disappear into the default black background? |
|
#7
| |||
| |||
| maffie writes: > Hum, for some reason, things doesn't seem to work. > > I have added the Plot keyword as follows: > > PLOT, X, /nodata,/normal,POSITION=[0.14,0.57,1,0.58] > > But still I can't see any axis when putting the following after the > keyword: > > myticklen=-0.01 > myticks=['C','A','N','NE','E','SE','S','SW','W','NW'] > myticks1=['P0','Rain','SWD','Tmax','Tmin','RH','F010','D010' ,'CC'] > mytickvals=[X1+9.8, X1+(9.8*2), X1+(9.8*3), X1+(9.8*4), X1+(9.8*5), > X1+(9.8*6), X1+(9.8*7), X1+(9.8*8), X1+(9.8*9), X1+(9.8*10)] > mytickvals1=[0.1,0.3,0.6,0.8,0.9] > AXIS, XAXIS=0,TICKLEN=myticklen,XTITLE='Weather type',$ > XTICKS=9, XTICKNAME=myticks, XTICKV=mytickvals,color=black, > CHARTHICK=3, CHARSIZE=1.3 > AXIS, YAXIS=0, TICKLEN=myticklen,YTICKS=8, YTICKNAME=myticks1, > YTICKV=mytickvals1,color=black,CHARTHICK=3, CHARSIZE=1.3 > > Any more ideas?? Get rid of the NORMAL keyword and add some LOG keywords. Set some ranges on your axes. Spend a couple of minutes thinking about what you are trying to do. :-) Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/ Sepore ma de ni thui. ("Perhaps thou speakest truth.") |
|
#8
| |||
| |||
| Well, I am thinking about already a long time actually, and it doens't seem to bring what I was hoping for. The idea of the axis is to plot axis which solely define classes, like for example variable names, without any other reference to the values plotted in the plot itself. So I just want to draw a line with a number of ticks which are denoted by their variable name. The strange thing hereby is that I can not see the axis, or axis title or any other information from the axis... |
|
#9
| |||
| |||
| maffie writes: > Well, I am thinking about already a long time actually, and it doens't > seem to bring what I was hoping for. > > The idea of the axis is to plot axis which solely define classes, like > for example variable names, without any other reference to the values > plotted in the plot itself. So I just want to draw a line with a > number of ticks which are denoted by their variable name. > > The strange thing hereby is that I can not see the axis, or axis title > or any other information from the axis... Well, if we have eliminated everything else, then I would say drawing white on white is a good possibility. I'm not sure why everyone and his brother appears to think GhostView is the best display device these days, but there are color problems to watch out for in PostScript. Specifically, don't use the color indices 0 or 255 to specify *any* of your colors. Try defining a magenta color at color index 128 and then use that to draw your axis. See anything now? Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/ Sepore ma de ni thui. ("Perhaps thou speakest truth.") |
|
#10
| |||
| |||
| I have changed my color black to magenta on index 128 as you suggested, but this doesn't help. I don't really understand. I have plotted a lot of information on one page (plots, colorbar, some text information....), in the colors I like it to be, and all is visible. I just can't seem to get the axis appearing, although it was there when I ran my script yesterday. And this is the most bizarre thing to me? Maybe I should just try to plot the variables name with XYOUTS as a string, on the location I want them to be on? As there is no direct relation with the values shown in the plot... |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.