Gnuplot fine grained ranges(grid) - gnuplot

I have this graph created with gnuplot
However the red line at the bottom seems like very straight due to the y-axis range although it is not (it should look like the blue one). How can make the range of the y-axis very fine grained (lots of ticks) so very small values of the red graph can be visible ? Hope I was clear thanks.

I can think of two possible solutions to your question.
Use a logarithmic scale with set logscale y. This would change the look of your plot quite a bit but you would still have all the data related to a single scale and it would most probably introduce a "higher resolution" to your red line.
Introduce a second y-axis like in this example.
As far as I know, it is not possible to increase the resolution only on a specific part of an axis. I think, this would lead to more confusion than it would do any good.

Related

Is there a way to dull/fade the coloring of marks in Altair?

I have the following DataFrame (only a part of it is shown):
I use it to generate the following plot in Altair. I generated this plot based on a modification of the code suggested in this post.
However, due to the fact that each of my Y labels has a different number of associated data points, the only way I could make the plot appear as desired was by using np.resize to repeat values. This works almost perfectly, but leads to the unfortunate issue that some of the marks in the plot appear darker than others, which can be misleading because it does not actually relate to the data in any way. Is there any way to get around this in Altair?
It sounds like you're asking about the opacity of the marks, which defaults to semi-transparent. You can adjust this with the opacity argument to mark_point(); for example:
alt.Chart(data).mark_point(opacity=1)

Fitting multiple curves to one data set

I have a data set that I receive from an outside source, and have no real control over.
The data, when plotted, shows two clumps of points with several sparse, irrelevant points. Here is a sample plot:
There is a clump of points on the left, clustered around (1, 16). This clump is actually part of a set of points that lies on (or near to) a line stretching from (1, 17.5) to (2.4, 13).
There is also an apparent curve from (1.75, 18) to (2.75, 12.5).
Finally, there are some sparse points above the second curve, around (2.5, 17).
Visually, it's not difficult to separate these groups of points. However, I need to separate these points within the data file into three groups, which I'll call Line, Curve, and Other (the Curve group is the one I actually need). I'd like to write a program that can do this reasonably well without needing to visually see the plot.
Now, I'm going to add a couple items that make this much worse. This is only a sample set of data. While the shapes of the curve and line are relatively constant from one data set to the next, the positions are not. These regions can (and do) shift, both horizontally and vertically. The only real constant is that there's a negative-slope line from the top-left to the bottom-right of the plot, an almost curve from the top-center to the bottom-right, and most of the sparse points are in the top-right corner, above the curve.
I'm on Linux, and I'm out of ideas. I can tell you the approaches that I've tried, though they have not done well.
First, I cleaned up the data set and sorted it in ascending order by x-coordinate. I thought that maybe the points were sorted in some sort of a logical way that would allow me to 'head' or 'tail' the data to achieve the desired result, but this was not the case.
I can write a code in anything (Python, Fortran, C, etc.) that removes a point if it's not within X distance of the previous point. This would be just fine, except that the scattering of the points is such that two points very near each other in x, are separated by an appreciable distance in y. It also doesn't help that the Line and Curve draw near one another for larger x-values.
I can fit a curve to a partial data set. When I sort the data by x-coordinate, for example, I can choose to only plot the first 30 points, or the last 200, or some set of 40 in the middle somewhere. That's not a problem. But the Line points tuck underneath the Curve points, which causes a problem.
If the Line points were fairly constant (which they're not), I could rotate my plot by some angle so that the Line is vertical and I can just look at the points to the right of that line, then rotate back. This may the best way to go about doing this, but in order to do that, I need to be able to isolate the linear points, which is more or less the essence of the problem.
The other idea that seems plausible to me, is to try to identify point density and split the data into separate files by those parameters. I think this is the best candidate for this problem, since it is independent of point location. However, I'm not sure how to go about doing this, especially because the Line and Curve do come quite close together for larger x-values (In the sample plot, it's x-values greater than about 2).
I know this does not exactly fall in with the request of a MWE, but I don't know how I'd go about providing a more classical MWE. If there's something else I can provide that would help, please ask. Thank you in advance.

Gnuplot: how to mimic sketch graphs

I want to plot a figure like this one:
but with only sketched data curves. The x and y axes should not be sketched.
Is this possible using Gnuplot?
I think you may find this link useful, since it's exactly what you are asking for :)
http://rfonseca.github.io/xkcd-gnuplot/
Essentially, it applies a function to jiggle the line and make it pseudo-hand-drawn:
jiggle(x) = x*(1+(2*rand(0)-0.5)*0.015)
plot jiggle(sin(x))
And this is the result:
You may also want to increase samples with set samples 1000 to have better results avoiding spikes in jiggled lines.
(As a curiosity, that page is inspired by a StackExchange answer, that contains a very advanced (and amazing, IMHO) approach to this problem, unfortunately only for Mathematica users.)

Suggestion on matplotlib colors : Need distinct shades.

I'm plotting a voronoi diagram in which I shade the polygons depending on a proportional probability( By which I mean, If I were to plot give polygons their total probability might be 1).This is my code where I give the facecolor as the probability value.
matplotlib.patches.Polygon(poly, facecolor= probList[i])
The problem is the shades are not distinct enough to reflect my probability values. I'm fine with going any colors as long as the shades reflect probability.StackOverflow ppl, please throw in your suggestions.Thanks!
Picking from matplotlibs colormaps is probably a good start. The link shows all of the preset colormaps.
My favorites (and a common choice) for ordered values (like probability, which goes from zero to one) are hot or afmhot, because they show good distinction of intermediate values and have clear perceptual ordering.
Below are the sequential colormaps from matplotlib (taken from the reference above). Or, see the full set (again, at the reference above) if you want more distinction at the cost of less obvious ordering. (Even if you choose to not use a sequential colormap, you might still want to avoid the unfortunately popular jet colormap because, amongst other reasons, it starts and ends with dark colors, making it hard to understand).

D3 - Difference between basis and linear interpolation in SVG line

I implemented a multi-series line chart like the one given here by M. Bostock and ran into a curious issue which I cannot explain myself. When I choose linear interpolation and set my scales and axis everything is correct and values are well-aligned.
But when I change my interpolation to basis, without any modification of my axis and scales, values between the lines and the axis are incorrect.
What is happening here? With the monotone setting I can achieve pretty much the same effect as the basis interpolation but without the syncing problem between lines and axis. Still I would like to understand what is happening.
The basis interpolation is implementing a beta spline, which people like to use as an interpolation function precisely because it smooths out extreme peaks. This is useful when you are modeling something you expect to vary smoothly but only have sharp, infrequently sampled data. A consequence of this is that resulting line will not connect all data points, changing the appearance of extreme values.
In your case, the sharp peaks are the interesting features, the exception to the typically 0 baseline value. When you use a spline interpolation, you are smoothing over these peaks.
Here is a fun demo to play with the different types of line interpoations:
http://bl.ocks.org/mbostock/4342190
You can drag the data around so they resemble a sharp peak like yours, even click to add new points. Then, switch to a basis interpolation and watch the peak get averaged out.

Resources