plot String data [message #93140] |
Sun, 01 May 2016 10:56  |
Ali Gamal
Messages: 98 Registered: June 2013
|
Member |
|
|
hi,
I have string data and normal data , I want to plot this data as X axis string data and Y x with normal data.
;;;;;;;;;;;;;;;;;;;;;;;;;;;
openr,1,'/home/a.txt'
a=strarr(49)
readf,1,a
openr,2,'/home/b.dat'
b=fltarr(49)
readf,2,b
plot,a,b
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;
but it is not true.
|
|
|
Re: plot String data [message #93142 is a reply to message #93140] |
Mon, 02 May 2016 07:27   |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
So you have a string array X = ['lions','tigers','bears'] and you want to plot Y versus X. I don't think so.
It is possible you want to make a box plot with the X axis labeled with strings.
You can find examples of how to do this in the PLOT help page
http://www.harrisgeospatial.com/docs/PLOT_Procedure.html
or on David Fanning's plot gallery
http://www.idlcoyote.com/gallery/
On Sunday, May 1, 2016 at 1:56:34 PM UTC-4, AGW wrote:
> hi,
> I have string data and normal data , I want to plot this data as X axis string data and Y x with normal data.
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;
> openr,1,'/home/a.txt'
> a=strarr(49)
> readf,1,a
> openr,2,'/home/b.dat'
> b=fltarr(49)
> readf,2,b
> plot,a,b
> end
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;
> but it is not true.
|
|
|
Re: plot String data [message #93144 is a reply to message #93140] |
Mon, 02 May 2016 13:31  |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Sunday, May 1, 2016 at 6:56:34 PM UTC+1, AGW wrote:
> hi,
> I have string data and normal data , I want to plot this data as X axis string data and Y x with normal data.
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;
> openr,1,'/home/a.txt'
> a=strarr(49)
> readf,1,a
> openr,2,'/home/b.dat'
> b=fltarr(49)
> readf,2,b
> plot,a,b
> end
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;
> but it is not true.
I did this sort of thing using function graphics. In my case, I did a histogram of the frequency with which certain words appeared. I then sorted the words according to their frequency and plotted this in a barplot type histogram. This works however also for a simple plot().
Basically it is something like this:
xx = findgen(10)
yy = findgen(10)
pp = plot(xx,yy)
pp['xaxis'].tickInterval = 1
tn = pp['xaxis'].tickname
for i=0,9 do tn[i]=string(byte(i)+97b)
tn[10] = ''
pp['xaxis'].tickname = tn
Something like this was shown a few days ago on the newsgroup and I found it really nice. I think it was Pablo P.
Cheers,
Helder
|
|
|