#include <QApplication>
#include <cmath>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/graphs/jkqtpimage.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
const int NX=100;
const int NY=100;
const double dx=1e-2;
const double dy=1e-2;
const double w=static_cast<double>(NX)*dx;
const double h=static_cast<double>(NY)*dy;
double airydisk[NX*NY];
double NA=1.1;
double wavelength=488e-3;
double x, y=-h/2.0;
for (int iy=0; iy<NY; iy++ ) {
x=-w/2.0;
for (int ix=0; ix<NX; ix++ ) {
const double r=sqrt(x*x+y*y);
const double v=2.0*M_PI*NA*r/wavelength;
airydisk[iy*NX+ix] = pow(2.0*j1(v)/v, 2);
x+=dx;
}
y+=dy;
}
graph->
setData(airydisk, NX, NY, JKQTPMathImageBase::DataType::DoubleArray);
plot.show();
plot.resize(600,600);
plot.setWindowTitle("JKQTPMathImage");
return app.exec();
}
void setMaintainAspectRatio(bool value)
en-/disables the maintaining of the data aspect ratio
void setUseAntiAliasingForSystem(bool __value)
specifies whether to use antialiasing for plotting the coordinate system
void setMaintainAxisAspectRatio(bool value)
en-/disables the maintaining of the axis aspect ratio
void setUseAntiAliasingForGraphs(bool __value)
specifies whether to use antialiasing for plotting the graphs
void setUseAntiAliasingForText(bool __value)
specifies whether to use antialiasing when drawing any text
void setAxisLabel(const QString &__value)
axis label of the axis
void setHeight(double __value)
height of image
void setX(double __value)
x coordinate of lower left corner
void setWidth(double __value)
width of image
void setY(double __value)
y coordinate of lower left corner
virtual void setData(const void *__value)
points to the data array, holding the image
class to plot an image from an 2-dimensional array of values
Definition jkqtpimage.h:433
virtual void setTitle(const QString &title) override
sets the title of the plot (for display in key!).
plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing)
Definition jkqtplotter.h:364
void zoomToFit(bool zoomX=true, bool zoomY=true, bool includeX0=false, bool includeY0=false, double scaleX=1.05, double scaleY=1.05)
this method zooms the graph so that all plotted datapoints are visible.
Definition jkqtplotter.h:1039
JKQTPVerticalAxisBase * getYAxis(JKQTPCoordinateAxisRef axis=JKQTPPrimaryAxis)
returns the y-axis objet of the plot
Definition jkqtplotter.h:713
JKQTBasePlotter * getPlotter()
returns the JKQTBasePlotter object internally used for plotting
Definition jkqtplotter.h:404
size_t addGraph(JKQTPPlotElement *gr)
Definition jkqtplotter.h:784
JKQTPHorizontalAxisBase * getXAxis(JKQTPCoordinateAxisRef axis=JKQTPPrimaryAxis)
returns the x-axis objet of the plot
Definition jkqtplotter.h:711