Now that we have Image plots capability in ILNumerics, I am replacing all my code to use ImageSc plots inplace of surface plots.
For surface plots, we can specify X and Y scale values in the form of grid. Is there any way to modify the index based scale values for image plots without overwriting TickCreationFunction?
you could place the plot inside a group and use the group to translate the plot inside the plot cube:
private void ilPanel1_Load(object sender, EventArgs e) {
ilPanel1.Scene.Add(new ILPlotCube(twoDMode: false) {
new ILGroup(translate: new Vector3(-5,10,100)) {
new ILImageSCPlot(ILSpecialData.sincf(10,20))
}
});
}
This would work with any plot object - not only ImageSC.
Related
I am trying to do the paint on Javafx. I am using a pane and draw an irregular shape using the code below (like using the pencil in the Microsoft Paint). Then I wished to colour the shape. I have no idea how to fill the colour.
The following code is how I draw on the pane.
#FXML
private void drawingAreaMouseDragged(MouseEvent e) {
if(e.getX() > 0 && e.getY() > 0) {
if(isPen) {
if(e.getX() > penSize && e.getY() > penSize) {
Circle newCircle = new Circle(e.getX(), e.getY(), penSize, pForeColor);
group.getChildren().add(newCircle);
}
}
}
What I expecting is something like the following pictures (like the Microsoft Paint). First, draw using pencil and form the irregular shape. Then fill it.
new pane
shape drawn using pencil
fill with colour
I have a scatterplot that I would like to fit into an existing view:
scatterchart("Test", NumberAxis(), NumberAxis()) {
}
But I would like to get rid of the title at the top to centre the scatterplot in its view.
I have tried to set the title to an empty string but to no avail:
scatterchart("", NumberAxis(), NumberAxis()) {
// I'm looking for a method like this:
title.isVisible(false)
}
My goal is to get rid of that empty space at the top of the chart for a uniform look.
I'm not even sure what the correct way would be in JavaFx. Let me know if I'm on the right track, cheers!
Set the title to null:
scatterchart(null, NumberAxis(), NumberAxis())
Alternatively:
scatterchart(x = NumberAxis(), y = NumberAxis())
Take a look at the screenshot: there are a few labels on both axis even though there is no related chart points. Can i configure chart control to show labels only when there is some data on chart (see second picture)?
Actual
Desired
If you want to customize the label with a specific axis value then you should handle the ChartControl.CustomDrawAxisLabel event. Please refer to the sample code snippet in the CustomDrawAxisLabel documentation article.
private void chartControl1_CustomDrawAxisLabel(object sender, CustomDrawAxisLabelEventArgs e)
{
AxisBase axis = e.Item.Axis;
if (axis is AxisY || axis is AxisY3D || axis is RadarAxisY)
{
//Put your condition at below two lines..
double axisValue = (double)e.Item.AxisValue;
if (axisValue == 0)
{
e.Item.Text = string.Empty;
}
}
}
Refer these for more information with change of point values:
Conditionally change a chart axis label not based on axis value
I'm using a QwtPlotSpectrogram with a custom QwtRasterData to plot 2D data with widely varying values. I would like to plot using a logarithmic color scale instead of a linear one. Is there a simple way to do this?
My alternative is to feed log(value(x,y)) when QwtRasterData calculates the value. However, then my color bar will show the values in log, rather than the absolute values which is what I want - any suggestions there?
Thanks!
In case this is still interesting for anyone:
I had the same problem and wrote the following simple class:
class LogarithmicColorMap : public QwtLinearColorMap
{
public:
LogarithmicColorMap(const QColor &from, const QColor &to)
: QwtLinearColorMap(from, to)
{
}
QRgb rgb(const QwtInterval &interval, double value) const
{
return QwtLinearColorMap::rgb(QwtInterval(std::log(interval.minValue()),
std::log(interval.maxValue())),
std::log(value));
}
};
And for the color bar you can use something like:
setAxisScaleEngine(QwtPlot::yRight, new QwtLog10ScaleEngine())
I have a column chart that uses a label function to format the vertical axis. I added a button and want the axis (or chart) to redraw when the button is clicked. Right now, the chart axis renders OK only when initially added to the view state.
I have a function that sets various properties after the chart is initially created. In there, I have tried all these:
myChart.verticalAxis.dataChanged();
myChart.validateNow();
myChart.validateDisplayList();
myChart.validateProperties();
myChart.invalidateDisplayList();
myChart.invalidateProperties();
But they do not change the axis formatting. How can I do this?
The MXML code for the axis is:
< mx:LinearAxis id="verticalAxis" labelFunction="vAxisFormat"/>
The label function is:
private function vAxisFormat(labelValue:Number, previousValue:Object, axis:IAxis):String {
axis.getLabelEstimate();
if (_scale == 1){
return currencyFormatter.format(labelValue/_scale);
}else {
return numberFormatter.format(labelValue/_scale);
}
}
Try updating the data provider. This redraws the graph, so all the components.
Example:
ArrayCollection
arr.refresh ();
XML
char.dataprovider = xmlData
regars