Accessing ScalaFX chart axis extreme values - scala

I'm building a regression visualiser and can plot the original data and calculate the regression model. For fitting, I'd like to include predictions for the whole chart axis range available, not only the original data range.
Creating the empty chart sets xAxis 0 to 110 by default.
Then I'm plotting the data:
How can I access the visible xAxis extreme values, and especially the upper 5.5?
Trying xAxis.getUpperBound gives the original 110.

Related

How to rescale vector field onto a different grid?

I currently have a vector field that looks something like this, generated with the following basic structure, where Z is some matrix:
[X,Y] = meshgrid(x,y)
[grad_x, grad_y] = gradient(Z)
quiver(X,Y,grad_x,grad_y)
I would like for this plot to be rescaled, such that the x-axis ranges from 1.5 to 3.8 and the y-axis ranges from 100 to 250, but for the arrows themselves to look identical. The only difference in the figure should be the axes labels.
I have tried:
grad_x_rescaled = [(grad_x - min(grad_x))./(max(grad_x)-min(grad_x))].*(3.8-1.5);
grad_y_rescaled = [(grad_y - min(grad_y))./(max(grad_y)-min(grad_y))].*(250-100);
But the problem with this is that although the grad_x and grad_y get rescaled overall, the scaling of the arrows themselves relative to each other are not conserved, and results in below (note the thick black streaks are presumably arrowheads, but the important thing is that the direction and relative sizes of the arrows are not exactly like in the first case.
Is there a matlab function or an expression to renormalize data into a new range, but such that the renormalized data is scaled relative to itself (such as the arrows should be scaled the same relative to one another)?
To simply change the axes tick labels you could use Matlab's ability to specify tick marks and tick labels. Basically you would just tell Matlab where to put the ticks and what the labels should say like this:
xticks(linspace(0,1,6))
xticklabels(linspace(1.5,3.8,6))
yticks(linspace(0,1,6))
yticklabels(linspace(100,250,6))

Residual analysis and subtracting values between scatter plots

I am trying to subtract the two corresponding values for each of the scatter plots to get a residual. Each point on the scatter plot below has a corresponding point in the plot above, but simply with a different value. For example, NE at the very left has a value of 0.5 in the top scatter plot and I'd like to subtract from it the value in the bottom plot which is 1. I have been trouble doing this. I couldn't get a level of detail calculation to work, because that aggregates everything, and I simply can't make a table calculation of avg(average scores) - predicted score. The predicted score is really just a trend line fitted on to the top scatter plot. Any help is appreciated.

Visualizing 1D data in MATLAB

I have a vector which gives the speed of a rat over time. Could someone please help me on how I can show this data with a "color map" or "color bar". Basically I want to show each data point with a color.
As what Suever suggested, using imagesc is perfectly fine for your purposes. You can also add in a colour bar to give meaning of the mapped colours to the values in your vector. The y-axis won't have any meaning as you'll want to concentrate on the colours themselves. Therefore, you'll want to blank out the y-axis by grabbing a handle to the current axes in the plot and just setting the y-axis labels to blank.
As such, do something like this assuming that your data is stored in the vector data:
data = rand(1,100); %// random dummy data - 100 element vector
imagesc(data);
colorbar;
set(gca, 'YTick', []);
We get this image now:
Note that the colour bar on the right is scaled using the lowest and highest values in your data. The colours will be scaled so that it conforms to this lowest and highest value.

jaspersoft jfreechart range or y axis is derived incorrectly

I am using jasper reports with charting. The chart generally works with a wide variety of values.
In one case the values are either 1.011 or 1.01 for the range or Y axis. That is, the user tries to generate a chart and some of the values are 1.011 and some are 1.01.
The challenge is, when generating a chart with these values, the chart is scaled incorrectly on the range or Y axis. The labels range from 1.000 to 1.010 with increments of .001. As the top of the chart is 1.010, the values 1.011 fall off the top of the chart and don't appear on the chart.
Can anybody explain how the range or Y axis is derived beyond stating that the axis is derived from the data. And why, in this case, is the axis derived
incorrectly?
Is there a way to configure the chart to display the range or Y axis more correctly?
I edit a jrxml file. I do not use iReports or java api.
Thanks for all of your assistance and good ideas

Creating a Bar Graph where each Bar is a Histogram

I'm creating a line plot, where the y value of each point is the average value of vector i. The x value of each point is i.
I want to visualise the distribution of numbers in each vector, preferably all on the same graph.
Is there a way I can make a bar graph, where each bar, i, is something like a colorbar, representing the histogram of vector i. So essentially I want to end up with 20 or so bars, each being a histogram.
Or if there is a better way to visualise numerous histograms on a single plot, I'd like to hear it.
I solved the problem using Dan's solution. I took a histogram of each vector (with specific bin intervals), and stored them all in a 2D matrix (Each column is a complete histogram). Then displayed it with image() (Don't have access to imshow).
I did have to mess around with the axis labels though, as the image() function was plotting it according to the coordinates of the 2D matrix, rather than the values in the original vectors. Fixed that up with some calls to set(gca,'YTickLabel/YTick'). Also had to set the YDir back to 'normal' rather than 'reverse'. I think image() was flipping it.