Example of JPlotXY usage. Changing layout of axis.
Code: "jplot2d_axisdemo.py". Programming language: Python DMelt Version 1. Last modified: 05/09/2015. License: Pro
https://datamelt.org/code/cache/jplot2d_axisdemo_780.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.


 
from org.jplot2d.data import *
from org.jplot2d.element import *
from org.jplot2d.util  import *
from org.jplot2d.transform import *
from jhplot import *
from array import *

c1=HPlotXY(False)
c1.visible()
fac=c1.getFactory()
plot=c1.getPlot()

title=fac.createTitle("Reciprocal Axis Demo")
title.setFontScale(2);
plot.addTitle(title);


xaxis = fac.getInstance().createAxis();
xaxis.getTitle().setText("x axis");
plot.addXAxis(xaxis);
yaxis = fac.createAxis();
xaxis.getTitle().setText("y axis");
plot.addYAxis(yaxis);

xaux = fac.createAxis();
xaux.getTitle().setText("1/x axis");
plot.addXAxis(xaux);
xaux.getTickManager().setAxisTransform(xaxis.getTickManager().getAxisTransform());
xaux.getTickManager().setTickTransform(ReciprocalAxisTickTransform(2));

graphData = XYGraphData(ArrayPair(array('d',[0, 2, 4, 6, 8, 10]), array('d',[ 0, 0.6, 1, 0.4, 0.5, 0.8]) ))
graph = fac.createXYGraph(graphData);
layer0 = fac.createLayer();
layer0.addGraph(graph);
plot.addLayer(layer0, xaxis, yaxis);

xaxis.getTickManager().getAxisTransform().setTransform(TransformType.LOGARITHMIC);

You see the box below because you did not login.