comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » cgGallery with function graphics
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: cgGallery with function graphics [message #87799 is a reply to message #87793] Thu, 27 February 2014 07:46 Go to previous messageGo to previous message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
Woops! Here it is in its entirety (with the legend and coyote version)



=================
Copy + Paste
=================
; Set up variables for the plot. Normally, these values would be
; passed into the program as positional and keyword parameters.
; Create two random vectors.
data_1 = cgDemoData(17)
data_2 = cgDemoData(17)

; Calculate the data range, so you can create a plot with room at the top
; of the plot for the legend.
maxData = Max(data_1) > Max(data_2)
minData = Min(data_1) > Min(data_2)
dataRange = maxData - minData
yrange = [MinData, maxData + (dataRange*0.25)]

; Legend Properties
items = ['Experiment 1', 'Experiment 2']
psyms = [-15, -16]
colors = ['red7', 'blu7']

; Open a window and return its reference to the user.
aWindow = Window(WINDOW_TITLE="Line Plot with Legend")

;Create the Plot
ngPlot = Plot(data_1, /Current, Symbol='Circle', /Sym_Filled, Color='Red', $
YRange=yrange, YStyle=1, XTitle='Time', YTitle='Signal', $
Name='Experiment 1')
ngOPlot = Plot(data_2, Symbol='Square', /Sym_Filled, Color='Blue', $
Overplot=ngPlot, Name='Experiment 2')

;Add the legend
ngLegend = Legend(/Auto_Text_Color, Position=[5, 120], Target=[ngPlot, ngOPlot], /Data, $
Horizontal_Alignment='Left')






=================
Coyote Version
=================
PRO Line_Plot_With_Legend_FG, WINDOW=window
; Set up variables for the plot. Normally, these values would be
; passed into the program as positional and keyword parameters.
; Create two random vectors.
data_1 = cgDemoData(17)
data_2 = cgDemoData(17)

; Calculate the data range, so you can create a plot with room at the top
; of the plot for the legend.
maxData = Max(data_1) > Max(data_2)
minData = Min(data_1) > Min(data_2)
dataRange = maxData - minData
yrange = [MinData, maxData + (dataRange*0.25)]

; Legend Properties
items = ['Experiment 1', 'Experiment 2']
psyms = [-15, -16]
colors = ['red7', 'blu7']

; Open a window and return its reference to the user.
aWindow = Window(WINDOW_TITLE="Line Plot with Legend")

;Create the Plot
ngPlot = Plot(data_1, /Current, Symbol='Circle', /Sym_Filled, Color='Red', $
YRange=yrange, YStyle=1, XTitle='Time', YTitle='Signal', $
Name='Experiment 1')
ngOPlot = Plot(data_2, Symbol='Square', /Sym_Filled, Color='Blue', $
Overplot=ngPlot, Name='Experiment 2')

;Add the legend
ngLegend = Legend(/Auto_Text_Color, Position=[5, 120], Target=[ngPlot, ngOPlot], /Data, $
Horizontal_Alignment='Left')

END ;*********************************************************** ******

; This main program shows how to call the program and produce
; various types of output.

; Display the plot in a resizeable graphics window.
Line_Plot_With_Legend_FG, Window=window

; Create a PostScript file. Linestyles are not preserved in IDL 8.2.3 due
; to a bug. Only encapsulated PostScript files can be created.
window.save, 'ling_plot_with_legend.eps'

; Create a PNG file with a width of 600 pixels. Resolution of this
; PNG file is not very good.
window.save, 'ling_plot_with_legend.png', WIDTH=600

; For better resolution PNG files, make the PNG full-size, then resize it
; with ImageMagick. Requires ImageMagick to be installed.
window.save, 'ling_plot_with_legend_fullsize.png'
Spawn, 'convert ling_plot_with_legend_fg_fullsize.png -resize 600 ling_plot_with_legend_fg_resized.png'

END
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to align two images IDL
Next Topic: Is a Class diagram of catalyst avaliable ?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Tue Dec 02 19:46:06 PST 2025

Total time taken to generate the page: 1.68117 seconds