Is it possible to add a line for the total sum regardless of shiptype with right Y Axis showing total values something like in image
I have checked this question, but there was no answer there.
Here is working example on codesandbox
Related
I am using dimple.v2.3.0 to create line and area chart. When creating chart with category x-axis, Dimple leaves a gap between the y-axis and the line/area. I would like to ask is there any way to remove the gap?
I'm afraid there isn't a good answer for this, it's done this way because dimple allows you to combine with bars etc. There is a time axis for dates which will not include the gap and therefore answers the majority of cases with area charts, however categorical axes will always have the gap.
There is a hacky workaround you can use in this case where you have integers on your x axis which is to treat them as dates and put them on a time axis:
var x = myChart.addTimeAxis("x", "Call", "%Y", "%-Y");
x.timePeriod = d3.timeYear;
x.timeInterval = 1;
This will parse and display your calls as years and display them on the time axis. The "%-Y" display format shows a 4 digit year with no leading zeroes. This will work for integers up to 9999. Here it is working in your fiddle:
https://jsfiddle.net/zuuaar1t/
I want to create a dynamic bar chart with no of occurences on Y axis. Therefore, I need to make sure that only integer values are shown and this can be done with proper format:
chart.yAxis().tickFormat(d3.format('f'));
Right now I have only integer numbers but I have for example 1 displayed 3 times:
Is there any option to automatically display it in a nice way (i.e. to minimize number of ticks for charts with shorter range)?
chart.yAxis().tickFormat(d3.format("d"));
will work.
When you append the yAxis, define the ticks the same number as the max value of your y
svg.append("g").call(d3.axisLeft(y).ticks(maxY));
Or in your example that would be
chart.yAxis().ticks(maxY);
Or instead of defining the ticks, you could also define the exact tickValues which you can calculate from your values, this way you have the highest control.
I have a matrix of data, which is an output of automatic music transcription program. I want to plot it using gnuplot, assigning appropriate labels. Here's my dropbox with some data, where Intensity.dat is actual data, example.stn is a column of string values, some of which are to be displayed on y axis and example.all is just a result of paste example.stn Intensity.dat > example.all Script:
reset
set title "Intensity detection"
set palette negative grayscale
set cbrange [0.01:1]
set xlabel "Time [s]"
set ylabel "Musical note"
set terminal qt font "Verdana,16"
set logscale cb
xincr=0.04644
yincr=1
plot 'example.all' u (($1+0.5)*xincr):($2*yincr):3 matrix with image
produces
plot produced by script 1. Everything's OK, now just tic labels...
After I change the last line to plot 'example.all' u (($1+0.5)*xincr):($2*yincr):3 matrix rowheaders with image, the y-axis becomes too densly populated (It's plot2.jpg from my dropbox, link on top. Sorry guys, I'm new and it doesn't allow me to post more than 2 links).
What I want is a way to present only the labels I want (or hide others, whatever), not all at a time (because it looks unreadable). I'd also like to be able to quickly change them to the others when I need to do so. Supposingly, I want to display every 12th label, but still keep entire matrix with all rows plotted. Or every 12th starting from 2nd label AND every 12th starting from 6th. I've already tried many ways but I'm stuck. Functions like :ytics() or :yticlabels() can't make it, at least for me. And yes, I need this Verdana 16, and removing labels completely is out of question.
I'll be extra grateful if the method applies also for x-axis, as I have an analogical problem with x-axis in other plot, but I generally appreciate any help.
You can separate plotting the image from plotting the ytics like this:
condition(n) = (ceil(n)%12-2 == 0) || (ceil(n)%12-6 == 0)
plot 'Intensity.dat' u (($1+0.5)*xincr):($2*yincr):3 matrix with image ,\
'example.stn' u (NaN):0:ytic(condition($0) ? strcol(1) : "") notitle
The function condition checks whether the label should be plotted or not. I have used ceil to convert from a real number to an integer which is required by the modulo operator (%). The condition function is called with the linenumber $0. The NaN while plotting 'example.stn' avoids plotting data points while keeping the chance for setting the labels. If the condition is met (12th label starting from 2nd or 12th starting from 6th), we use the actual label, else an empty string is used.
I tho this was a pretty common requirement for a chart library, but I couldn't figure out how to achieve this.
I have a multichart(bars,area and lines) which displays time on the x-axis and temperature on the y-axis.
My max temperature across all the data series I've got is 22, and so my y-axis goes from 0 to 22. Can I make it to be ALWAYS from 0 to 100?
I tried with:
forceY = [0,100]
yAxis1.domain([0,100])
But all I get is from 0 to my max.
Suggestions?
thanks
Give yDomain1:[0,100]
working plunk here
I have a file that contains the map between the two entities. I have to plot the x and and Y axis in a graph using linux. The X axis is Time like (12:35:07) and the Y axis will have some integer numbers range (1-14). I need to plot the x and the Y axis using some method that should be called from linux shell script. X axis will have totally around 500 to 800 samples. say (from 12:14:00 to 12:30:00). Can anyone please help me out. I tried using GNUplot, but the graph is not proper. Sample input is given below
12:34:58 5
12:35:06 9
12:35:07 14
12:35:07 13
12:35:08 4
12:35:08 5
12:35:17 9
12:35:17 13
12:35:18 14
12:35:19 4
12:35:19 5
This is what I have written
1 set terminal png
2 set output 'test.png'
3 set xdata time
4 set timefmt "%H:%M:%S"
5 set yrange [1:15]
6 plot "Graph1" using 1:2 title 'data A'
The problem I have is since the image has large number of samples (around 700 intervals, I am not able to see each value properly. Also the Y axis is not proper. I need to restrict the Y axis to onlyh 10 values (1-10). Also I need to draw 4 similar graphs and place each graph in each corner (subplot). I have not done the subplot yet in GNUplot.
It seems that you have three main issues right now. For some of them the issue is not totally clear, so it would help if you could update your question (or make a comment) to clarify, and I can update my response.
1) Not able to see each of ~700 values properly.
Here I need a bit of clarification. I'm assuming you don't want to see each of 700 data points individually, rather you want to be able to get rid of clutter on the x axis which happens when plotting time values. For this you can use the command
set xtics X
where X is the interval between tics you want, in this case a number of seconds. Is this what you want?
You can also use
set format x '%M:%S'
(or something) if you want to control how the x values are displayed on the axis.
2) y axis needs to be restricted to 10 values.
Here also it's not totally clear what you are looking for. Do you want to scale everything down to be between 1 and 10? The range of your data presented is 4 to 14, so by subtracting four you can get things between 0 and 10 like this:
plot "Graph1" using 1:($2-4) title 'data A'
If you want to constrict an arbitrary y data set to be between 1 and 10, that's a little more tricky:
stats "Graph1"
plot "Graph1" using 1:(($2-STATS_min_y)*9/(STATS_max_y-STATS_min_y)+1) title 'data A'
The stats command gets statistics about a file before you plot it. The convoluted plot command should scale everything to be between 1 and 10 on the y axis.
3) You want to have 4 subplots.
This one is pretty easy. Before your first plot command, use the command
set multiplot layout 2,2
This will create a 2x2 grid for your plots. Every plot command will plot on a new subplot. Type help set multiplot at the gnuplot command line for details on changing the sequence of subplots used.