jyplot
Class JyplotVanilla
- java.lang.Object
-
- jyplot.JyplotVanilla
-
- All Implemented Interfaces:
- java.io.Serializable
public class JyplotVanilla extends java.lang.Object implements java.io.SerializableThe only dependenecies this class has is to JFreeChart itself. That means that is will load quicker and the memory footprint will be smaller. However, it lacks advanced options such asSaving EPS, SVG, or PDF images.
Nice for-Jython methods
Passing Colt numerical arrays to plot methods.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description JyplotVanilla()JyplotVanilla(boolean enableJFrame)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaxis(double[] p)sets the axis range manuallyBarXYDatasetbar(double[] left, double[] height, double[] width, double[] bottom, java.awt.Color color)BAR(left, height, width=0.8, bottom=0, color='b', yerr=None, xerr=None, ecolor='k', capsize=3) Make a bar plot with rectangles at left, left+width, 0, height left and height are Numeric arrays.voidbar(double left, double height, double width, double bottom, java.awt.Color color)voidbar(java.util.List<java.lang.Double> left, java.util.List<java.lang.Double> height, java.util.List<java.lang.Double> width, java.util.List<java.lang.Double> bottom, java.awt.Color color)voidbar(java.lang.Object[] x, double[] y)voidbar(java.lang.Object[] x, double[] y, java.awt.Color color)A quick hack to draw bar plots with whatever axisvoidclf()Clears the current figure.voidcolor(java.awt.Color c)Colors the most recent dataset or seriesvoidcolor(float value)Colors the most recent dataset or seriesvoidcolor(int[] rgba)Colors the most recent dataset or seriesvoidcolor(java.lang.String s)Colors the most recent dataset or seriesvoidconnect(ChartMouseListener listener)voiddifference(double[] x, double[] y1, double[] y2, java.awt.Color color, boolean multipleAxes)Plots a difference plot, y1 - y2 is shadedvoiddrawToGraphics2D(java.awt.Graphics2D g, int width, int height)Dataseterrorbar(double[] x, double[] y, double[] xerr, double[] yerr, java.awt.Color color, boolean barsabove)errorbar(x, y, yerr=None, xerr=None, fmt='b-', ecolor=None, capsize=3, barsabove=FalseJFreeChartgetChart()Get chartJFreeChartgetChart(int row, int col)java.util.HashMapgetChartPanelMap()java.util.HashMapgetChartToPanelMap()java.awt.ColorgetColor(java.lang.String s)Converts a string into a Color object.intgetCols()javax.swing.JFramegetFrame()javax.swing.JPanelgetJpanel()intgetRows()voidgrid(boolean state)voidgridx(boolean state)voidgridy(boolean state)voidhist(double[] data, int bins)voidhist(double[] data, int bins, java.lang.String dataname)XYDatasethist(double[] data, int bins, java.lang.String dataname, java.awt.Color color)voidlabel(java.lang.String p)set series label (key) for the legend for the most recent datasetvoidlegend(java.lang.String[] p)set series labels (keys) for the legendvoidlinecolor(java.awt.Color[] p)%% sets the line color for each Seriesvoidlinestyle(java.lang.String[] p)%% sets the line style (solid, dashed, ...) for each Seriesvoidlinewidth(float[] p)sets the line width for each Seriesvoidloglog()voidloglog(int p)transforms axes into a logarithmic scalestatic voidmain(java.lang.String[] args)XYDatasetplot(double[] y)XYDatasetplot(double[] x, double[] y)Plot X and YXYDatasetplot(double[] x, double[] y, java.awt.Color color)XYDatasetplot(double[] x, double[] y, java.awt.Color color, java.lang.String dataname, double[] yErrorBars, boolean seperateYAxis, boolean yaxisVisible, java.lang.String rangeLabel, boolean shapesVisible)voidsavefig(java.lang.String filename)This assumesvoidsavefig(java.lang.String filename, int width, int height)voidsetAntiAlias(boolean isAntiAlias)Set anti-AliasvoidsetBackgColor(java.awt.Color color)Sets the actual background color of the entire graph panel.voidsetChart(JFreeChart chart)voidsetChartToPanelMap(java.util.HashMap chartToPanelMap)voidsetDomainSpace(double x)voidsetFrame(javax.swing.JFrame frame)voidsetJpanel(javax.swing.JPanel jpanel)voidsetQuitOnWindowClose(boolean close)voidsetRangeSpace(double x)voidsetShapesVisible(boolean visible)voidshow()voidshow(int width, int height)voidsubplot(int number)voidsubplot(int rows, int cols, int plotnumber)Holds a list of arrays with the plotsvoidtext(java.lang.String text, double x, double y)Add some text at data coordinates x,yvoidtitle(java.lang.String p)sets the chart titlevoidtitle(java.lang.String p, int fontsize)voidxlabel(java.lang.String p)sets the x-axis labelvoidxlim(double min, double max)Sets the x axis range manuallyvoidxticks(double[] locations, java.lang.String[] ticklabels)Not properly tested.voidxticks(java.util.List<java.lang.Double> locations, java.util.List ticklabels)voidylabel(java.lang.String p)sets the y-axis labelvoidylim(double min, double max)Sets the y axis range manuallyvoidyticks(double[] locations, java.lang.String[] ticklabels)
-
-
-
Constructor Detail
-
JyplotVanilla
public JyplotVanilla(boolean enableJFrame)
-
JyplotVanilla
public JyplotVanilla()
-
-
Method Detail
-
subplot
public void subplot(int number)
-
subplot
public void subplot(int rows, int cols, int plotnumber)Holds a list of arrays with the plots- Parameters:
rows-cols-plotnumber-
-
show
public void show()
-
show
public void show(int width, int height)
-
plot
public XYDataset plot(double[] y)
-
plot
public XYDataset plot(double[] x, double[] y)
Plot X and Y- Parameters:
x- x valuesy- y values- Returns:
-
plot
public XYDataset plot(double[] x, double[] y, java.awt.Color color)
-
plot
public XYDataset plot(double[] x, double[] y, java.awt.Color color, java.lang.String dataname, double[] yErrorBars, boolean seperateYAxis, boolean yaxisVisible, java.lang.String rangeLabel, boolean shapesVisible)
-
title
public void title(java.lang.String p)
sets the chart title- Parameters:
p-
-
title
public void title(java.lang.String p, int fontsize)
-
xlabel
public void xlabel(java.lang.String p)
sets the x-axis label- Parameters:
p-
-
ylabel
public void ylabel(java.lang.String p)
sets the y-axis label- Parameters:
p-
-
legend
public void legend(java.lang.String[] p)
set series labels (keys) for the legend- Parameters:
p- []
-
label
public void label(java.lang.String p)
set series label (key) for the legend for the most recent dataset- Parameters:
p- []
-
linestyle
public void linestyle(java.lang.String[] p)
%% sets the line style (solid, dashed, ...) for each Series- Parameters:
p- []
-
linewidth
public void linewidth(float[] p)
sets the line width for each Series- Parameters:
p- []
-
linecolor
public void linecolor(java.awt.Color[] p)
%% sets the line color for each Series- Parameters:
p- []
-
axis
public void axis(double[] p)
sets the axis range manually- Parameters:
p- [] gets an array of the axis boundries: p0 = lower x, p1 = upper x p2 = lower y, p3 = upper y
-
xlim
public void xlim(double min, double max)Sets the x axis range manually
-
ylim
public void ylim(double min, double max)Sets the y axis range manually
-
loglog
public void loglog(int p)
transforms axes into a logarithmic scale- Parameters:
p- assign x- and y-axis as logarithmic
-
loglog
public void loglog()
-
main
public static void main(java.lang.String[] args)
- Parameters:
args- method for testing Jylab
-
bar
public void bar(java.lang.Object[] x, double[] y, java.awt.Color color)A quick hack to draw bar plots with whatever axis- Parameters:
y-x-
-
bar
public void bar(java.lang.Object[] x, double[] y)
-
bar
public void bar(double left, double height, double width, double bottom, java.awt.Color color)
-
bar
public void bar(java.util.List<java.lang.Double> left, java.util.List<java.lang.Double> height, java.util.List<java.lang.Double> width, java.util.List<java.lang.Double> bottom, java.awt.Color color)
-
bar
public BarXYDataset bar(double[] left, double[] height, double[] width, double[] bottom, java.awt.Color color)
BAR(left, height, width=0.8, bottom=0, color='b', yerr=None, xerr=None, ecolor='k', capsize=3) Make a bar plot with rectangles at left, left+width, 0, height left and height are Numeric arrays. *Currently this second argument format is not implemented... Return value is a list of Rectangle patch instances BAR(left, height, width, bottom, color, yerr, xerr, capsize, yoff) xerr and yerr, if not None, will be used to generate errorbars on the bar chart color specifies the color of the bar ecolor specifies the color of any errorbar capsize determines the length in points of the error bar caps The optional arguments color, width and bottom can be either scalars or len(x) sequences This enables you to use bar as the basis for stacked bar charts, or candlestick plots Addition kwargs: hold = [True|False] overrides default hold state
-
xticks
public void xticks(java.util.List<java.lang.Double> locations, java.util.List ticklabels)
-
xticks
public void xticks(double[] locations, java.lang.String[] ticklabels)Not properly tested.- Parameters:
ticklabels-
-
yticks
public void yticks(double[] locations, java.lang.String[] ticklabels)
-
connect
public void connect(ChartMouseListener listener)
-
getChartPanelMap
public java.util.HashMap getChartPanelMap()
-
drawToGraphics2D
public void drawToGraphics2D(java.awt.Graphics2D g, int width, int height)
-
color
public void color(java.awt.Color c)
Colors the most recent dataset or series- Parameters:
c-
-
color
public void color(java.lang.String s)
Colors the most recent dataset or series- Parameters:
s-
-
getColor
public java.awt.Color getColor(java.lang.String s)
Converts a string into a Color object. Checks a few local maps and the styleSheet class.- Parameters:
s-- Returns:
-
color
public void color(int[] rgba)
Colors the most recent dataset or series
-
color
public void color(float value)
Colors the most recent dataset or series
-
getChart
public JFreeChart getChart()
Get chart- Returns:
-
getChart
public JFreeChart getChart(int row, int col)
-
setChart
public void setChart(JFreeChart chart)
-
getChartToPanelMap
public java.util.HashMap getChartToPanelMap()
-
setChartToPanelMap
public void setChartToPanelMap(java.util.HashMap chartToPanelMap)
-
getFrame
public javax.swing.JFrame getFrame()
-
setFrame
public void setFrame(javax.swing.JFrame frame)
-
getJpanel
public javax.swing.JPanel getJpanel()
-
setJpanel
public void setJpanel(javax.swing.JPanel jpanel)
-
text
public void text(java.lang.String text, double x, double y)Add some text at data coordinates x,y- Parameters:
text-x-y-
-
difference
public void difference(double[] x, double[] y1, double[] y2, java.awt.Color color, boolean multipleAxes)Plots a difference plot, y1 - y2 is shaded
-
getCols
public int getCols()
-
getRows
public int getRows()
-
hist
public void hist(double[] data, int bins)
-
hist
public void hist(double[] data, int bins, java.lang.String dataname)
-
hist
public XYDataset hist(double[] data, int bins, java.lang.String dataname, java.awt.Color color)
-
grid
public void grid(boolean state)
-
gridx
public void gridx(boolean state)
-
gridy
public void gridy(boolean state)
-
clf
public void clf()
Clears the current figure. Preserves compatability with matplotlib.
-
errorbar
public Dataset errorbar(double[] x, double[] y, double[] xerr, double[] yerr, java.awt.Color color, boolean barsabove)
errorbar(x, y, yerr=None, xerr=None, fmt='b-', ecolor=None, capsize=3, barsabove=False
-
setRangeSpace
public void setRangeSpace(double x)
-
setDomainSpace
public void setDomainSpace(double x)
-
savefig
public void savefig(java.lang.String filename)
This assumes- Parameters:
filename-
-
savefig
public void savefig(java.lang.String filename, int width, int height)
-
setQuitOnWindowClose
public void setQuitOnWindowClose(boolean close)
-
setShapesVisible
public void setShapesVisible(boolean visible)
-
setBackgColor
public void setBackgColor(java.awt.Color color)
Sets the actual background color of the entire graph panel. Note that it is possible to set the color of the area within the axes system separately.- Parameters:
color- New background color.
-
setAntiAlias
public void setAntiAlias(boolean isAntiAlias)
Set anti-Alias- Parameters:
isAntiAlias-
-
-
DMelt 3.0 © DataMelt by jWork.ORG