jfig.utils
Class MHG

java.lang.Object
  extended byjfig.utils.MHG

public class MHG
extends java.lang.Object


Nested Class Summary
 class MHG.Axes
          the wrapper class responsible to transform world-coordinates to FIG coordinates at 2400 dpi.
 class MHG.FigTxtFileFilter
           
 class MHG.Figure
           
 
Constructor Summary
MHG()
           
 
Method Summary
 MHG.Axes axes()
          create default Axes, [0..1] x [0..1] for 8x6 inch paper
 MHG.Axes axes(MHG.Axes handle)
          set current axes
 MHG.Axes axes(java.lang.String position, double[] lbwh)
           
 void axis(double[] xxyy)
           
 void axis(double xmin, double xmax, double ymin, double ymax)
           
 void axis(java.lang.String attributes)
           
 FigObject[] bar(double[] y)
           
 FigObject[] bar(double[] y, java.lang.String attributes)
           
 boolean checkCreateAxes()
          check that we have a valid (non-null) Axes object or create axes (and figure) if necessary.
 void checkCreateFigure()
          check that currentFigure is valid (non-null) and create a new Figure if necessary.
 void cla()
          clear axes and all dependent objects - same as clf for now
 void clf()
          delete all objects from current figure
 int close()
          close current figure, return 1 if successful, 0 if not
 int close(MHG.Figure frame)
          close the specified figure
 int close(java.lang.String mode)
          "CLOSE ALL" "CLOSE ALL HIDDEN"
 void closeAllFigures()
           
 java.awt.Color color(double r, double g, double b)
           
 java.awt.Color color(java.lang.String rgb)
           
 void colormap(java.lang.String map)
           
 void doZoomFit()
           
 MHG.Figure figure()
          create new figure or set active figure
 MHG.Figure figure(MHG.Figure frame)
          set current figure, create if necessary
 FigPolyline fill(double[] x, double[] y, java.awt.Color color)
           
 FigPolyline fill(double[] x, double[] y, int[] indexes)
           
 FigPolyline fill(double[] x, double[] y, java.lang.String attributes)
           
static void FIXME()
           
static void FIXME(java.lang.String msg)
           
 MHG.Figure fullscreen(java.lang.String name, java.awt.Color cb, int mode, double[] lrbt)
           
 MHG.Figure fullscreen(java.lang.String name, java.awt.Color cb, int mode, double[][] nmij)
          create a new figure with the specified paramters.
 MHG.Axes gca()
           
 MHG.Figure gcf()
          return a reference to the current figure
 MHG.Figure getFigure(java.lang.String title)
          return a reference to a figure with the specified title
 MHG.Figure[] getFigures()
          return an array of all available figures
 int getLinestyle(java.lang.String s)
           
 void hide(MHG.Figure frame)
          hide the specified figure
 void hold(int i)
          set mode to 1="add", 0="replace"
 int ishold()
          return 1 if "add" mode, 0 if "replace" mode
 FigPolyline line(double[] x, double[] y)
           
 FigPolyline line(double[] x, double[] y, java.lang.String attributes)
           
 FigPolyline line(double x1, double y1, double x2, double y2, java.lang.String attributes)
           
 MHG.Figure load(java.io.File figFile)
           
 MHG.Figure load(java.net.URL figUrl)
          load the contents of a FIG url into the current / or newly created figure
 FigObject marker(double x, double y, java.lang.String s)
           
 FigObject marker(double x, double y, java.lang.String s, boolean redraw)
           
static void msg(java.lang.String s)
           
 java.awt.Color parseMatlabColor(java.lang.String s)
           
 FigPolyline patch(double[] x, double[] y, java.awt.Color color)
           
 FigPolyline patch(double[] x, double[] y, int[] indexes)
           
 FigPolyline patch(double[] x, double[] y, java.lang.String attributes)
           
 FigObject[] plot(double[] y)
           
 FigObject[] plot(double[] x, double[] y)
           
 FigObject[] plot(double[] x, double[] y, java.lang.String attributes)
          plot data using the specified attributes.
 FigObject[] plot(double[] y, java.lang.String attributes)
           
 void plotCartesianAxes()
           
 void plotGrid()
          plot a grid.
 void plotGridX(double[] ticks)
          plot vertical grid lines at the given (world-) x-coordinates.
 void plotGridY(double[] ticks)
          plot horizontal grid lines at the given (world-) y-coordinates.
 void plotLinearAxisX(double[] ticks)
          plot a linear-spaced x-axis with tick-marks at the specified coordinates.
 void plotLinearAxisY(double[] ticks)
           
 void redraw()
           
 void reshape(double[] lrbt)
          set new window size; corresponding to fullscreen conventions: [l,r,u,o] with each paramter in the range of 0..1.
 void reshape(double[][] nmij)
          set new window size; corresponding to fullscreen conventions: screen space is divided into a n*m matrix, the window is positioned into slot (i,j).
 void save(java.io.File outputFile)
           
 void setMarkerPtSize(double ptSize)
           
 void show(MHG.Figure frame)
           
 FigPolyline spline(double[] x, double[] y, java.lang.String attributes)
           
 FigObject[] stairs(double[] y)
           
 FigObject[] stairs(double[] x, double[] y)
           
 FigObject[] stairs(double[] x, double[] y, java.lang.String attributes)
           
 FigObject[] stairs(double[] y, java.lang.String attributes)
           
 FigObject[] stem(double[] y)
           
 FigObject[] stem(double[] x, double[] y)
           
 FigObject[] stem(double[] x, double[] y, java.lang.String attributes)
           
 FigObject[] stem(double[] y, java.lang.String attributes)
           
 FigText text(double x, double y, double z, java.lang.String label)
           
 FigText text(double x, double y, double z, java.lang.String label, java.lang.String attributes)
           
 FigText text(double x, double y, java.lang.String label)
           
 FigText text(double x, double y, java.lang.String label, java.lang.String attributes)
           
 FigText title(java.lang.String label)
           
 FigText title(java.lang.String label, java.lang.String attributes)
           
 double[] toDoubleArray(java.lang.String s)
          parse the given string and construct a double[] array from it.
 java.awt.Point[] toPoints(int[] ix, int[] iy)
           
 FigText xlabel(java.lang.String label)
           
 FigText xlabel(java.lang.String label, java.lang.String attributes)
           
 FigText ylabel(java.lang.String label)
           
 FigText ylabel(java.lang.String label, java.lang.String attributes)
           
 FigText zlabel(java.lang.String label)
           
 FigText zlabel(java.lang.String label, java.lang.String attributes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MHG

public MHG()
Method Detail

msg

public static void msg(java.lang.String s)

FIXME

public static void FIXME()

FIXME

public static void FIXME(java.lang.String msg)

figure

public MHG.Figure figure()
create new figure or set active figure


figure

public MHG.Figure figure(MHG.Figure frame)
set current figure, create if necessary


checkCreateFigure

public void checkCreateFigure()
check that currentFigure is valid (non-null) and create a new Figure if necessary.


close

public int close()
close current figure, return 1 if successful, 0 if not


close

public int close(MHG.Figure frame)
close the specified figure


close

public int close(java.lang.String mode)
"CLOSE ALL" "CLOSE ALL HIDDEN"


closeAllFigures

public void closeAllFigures()

gcf

public MHG.Figure gcf()
return a reference to the current figure


getFigures

public MHG.Figure[] getFigures()
return an array of all available figures


getFigure

public MHG.Figure getFigure(java.lang.String title)
return a reference to a figure with the specified title


hide

public void hide(MHG.Figure frame)
hide the specified figure


show

public void show(MHG.Figure frame)

reshape

public void reshape(double[][] nmij)
set new window size; corresponding to fullscreen conventions: screen space is divided into a n*m matrix, the window is positioned into slot (i,j).


reshape

public void reshape(double[] lrbt)
set new window size; corresponding to fullscreen conventions: [l,r,u,o] with each paramter in the range of 0..1. Note that the origin (0,0) is at the lower left.


fullscreen

public MHG.Figure fullscreen(java.lang.String name,
                             java.awt.Color cb,
                             int mode,
                             double[][] nmij)
create a new figure with the specified paramters. The size parameters are either nmij: n x m subplots, slot (i,j) or relative sizes left,right,bottom,top with the origin (0,0) at the lower left.


fullscreen

public MHG.Figure fullscreen(java.lang.String name,
                             java.awt.Color cb,
                             int mode,
                             double[] lrbt)

load

public MHG.Figure load(java.net.URL figUrl)
load the contents of a FIG url into the current / or newly created figure


load

public MHG.Figure load(java.io.File figFile)

save

public void save(java.io.File outputFile)

cla

public void cla()
clear axes and all dependent objects - same as clf for now


clf

public void clf()
delete all objects from current figure


redraw

public void redraw()

doZoomFit

public void doZoomFit()

ishold

public int ishold()
return 1 if "add" mode, 0 if "replace" mode


hold

public void hold(int i)
set mode to 1="add", 0="replace"


axes

public MHG.Axes axes()
create default Axes, [0..1] x [0..1] for 8x6 inch paper


axes

public MHG.Axes axes(java.lang.String position,
                     double[] lbwh)

axes

public MHG.Axes axes(MHG.Axes handle)
set current axes


checkCreateAxes

public boolean checkCreateAxes()
check that we have a valid (non-null) Axes object or create axes (and figure) if necessary. We return true, if we had to create a new Axes object.


gca

public MHG.Axes gca()

axis

public void axis(double[] xxyy)

axis

public void axis(double xmin,
                 double xmax,
                 double ymin,
                 double ymax)

axis

public void axis(java.lang.String attributes)

line

public FigPolyline line(double[] x,
                        double[] y)

line

public FigPolyline line(double[] x,
                        double[] y,
                        java.lang.String attributes)

line

public FigPolyline line(double x1,
                        double y1,
                        double x2,
                        double y2,
                        java.lang.String attributes)

patch

public FigPolyline patch(double[] x,
                         double[] y,
                         java.awt.Color color)

patch

public FigPolyline patch(double[] x,
                         double[] y,
                         int[] indexes)

patch

public FigPolyline patch(double[] x,
                         double[] y,
                         java.lang.String attributes)

fill

public FigPolyline fill(double[] x,
                        double[] y,
                        java.awt.Color color)

fill

public FigPolyline fill(double[] x,
                        double[] y,
                        java.lang.String attributes)

fill

public FigPolyline fill(double[] x,
                        double[] y,
                        int[] indexes)

spline

public FigPolyline spline(double[] x,
                          double[] y,
                          java.lang.String attributes)

text

public FigText text(double x,
                    double y,
                    java.lang.String label)

text

public FigText text(double x,
                    double y,
                    java.lang.String label,
                    java.lang.String attributes)

text

public FigText text(double x,
                    double y,
                    double z,
                    java.lang.String label)

text

public FigText text(double x,
                    double y,
                    double z,
                    java.lang.String label,
                    java.lang.String attributes)

title

public FigText title(java.lang.String label)

title

public FigText title(java.lang.String label,
                     java.lang.String attributes)

xlabel

public FigText xlabel(java.lang.String label)

xlabel

public FigText xlabel(java.lang.String label,
                      java.lang.String attributes)

ylabel

public FigText ylabel(java.lang.String label)

ylabel

public FigText ylabel(java.lang.String label,
                      java.lang.String attributes)

zlabel

public FigText zlabel(java.lang.String label)

zlabel

public FigText zlabel(java.lang.String label,
                      java.lang.String attributes)

plot

public FigObject[] plot(double[] x,
                        double[] y)

plot

public FigObject[] plot(double[] x,
                        double[] y,
                        java.lang.String attributes)
plot data using the specified attributes. The attribute string can contain any of the standard jfig attributes, e.g. "linecolor=red layer=150 linewidth=3 linestyle=dashed" or Matlab-style attributes. Supported Matlab attributes include: "-|--|:|-." for solid, dashed, dotted, dash-dotted lines. "+|o|*|.|x|s|d|^|v|<|>|p|h" for plus, circle, asterisk, point, cross, square, diamond, triangles, five-pointed star, six-pointed star. "r|g|b|c|m|y|k|w" red, green, blue, cyan, magenta, yellow, black, white.

The decision whether to use jfig or Matlab attributes is based on the existence of an equals "=" sign (which is required for jfig).


plot

public FigObject[] plot(double[] y)

plot

public FigObject[] plot(double[] y,
                        java.lang.String attributes)

stem

public FigObject[] stem(double[] y)

stem

public FigObject[] stem(double[] y,
                        java.lang.String attributes)

stem

public FigObject[] stem(double[] x,
                        double[] y)

stem

public FigObject[] stem(double[] x,
                        double[] y,
                        java.lang.String attributes)

stairs

public FigObject[] stairs(double[] y)

stairs

public FigObject[] stairs(double[] y,
                          java.lang.String attributes)

stairs

public FigObject[] stairs(double[] x,
                          double[] y)

stairs

public FigObject[] stairs(double[] x,
                          double[] y,
                          java.lang.String attributes)

bar

public FigObject[] bar(double[] y)

bar

public FigObject[] bar(double[] y,
                       java.lang.String attributes)

colormap

public void colormap(java.lang.String map)

color

public java.awt.Color color(double r,
                            double g,
                            double b)

color

public java.awt.Color color(java.lang.String rgb)

marker

public FigObject marker(double x,
                        double y,
                        java.lang.String s)

marker

public FigObject marker(double x,
                        double y,
                        java.lang.String s,
                        boolean redraw)

setMarkerPtSize

public void setMarkerPtSize(double ptSize)

toPoints

public java.awt.Point[] toPoints(int[] ix,
                                 int[] iy)

parseMatlabColor

public java.awt.Color parseMatlabColor(java.lang.String s)

getLinestyle

public int getLinestyle(java.lang.String s)

plotCartesianAxes

public void plotCartesianAxes()

toDoubleArray

public double[] toDoubleArray(java.lang.String s)
parse the given string and construct a double[] array from it. Numbers should be separated by spaces. This method returns null for a null argument and an array of length 0 for the empty (but non-null) string.


plotLinearAxisX

public void plotLinearAxisX(double[] ticks)
plot a linear-spaced x-axis with tick-marks at the specified coordinates. The appearance of the line can be controlled via the following figure properties: "AXIS_LINE_ATTRIBUTES", "AXIS_TICK_LENGTH", "AXIS_NUMBER_OF_X_TICKS", "AXIS_XLABEL_FORMAT", "AXIS_XLABEL_ATTRIBUTES" "AXIS_XLABEL_LABELS" (space-separated)


plotLinearAxisY

public void plotLinearAxisY(double[] ticks)

plotGrid

public void plotGrid()
plot a grid. The default grid consists of 11 evenly-spaced x- and y-lines. However, when the AXIS_XTICKS or AXIS_YTICKS values have been set previously, those values are used for the grid line positions. The appearance of those lines can be controlled via the "GRID_STYLE" property.


plotGridX

public void plotGridX(double[] ticks)
plot vertical grid lines at the given (world-) x-coordinates. The appearance of those lines can be controlled via the "GRID_STYLE" property.


plotGridY

public void plotGridY(double[] ticks)
plot horizontal grid lines at the given (world-) y-coordinates. The appearance of those lines can be controlled via the "GRID_STYLE" property.