Warning: Ignoring extra legend entries. - matlab-figure

I am creating several plots. Each plot can have up to 5 lines. At the end of my code I am including the line:
legend([line0 line1 line2 line3 line4],{'DN','D','R','ME','PP'})
However, sometimes some of the lines (line0 to line4) have no points on them, and therefore matlab gives an error saying:
Warning: Ignoring extra legend entries.
Although the lines have no points, I still want matlab to include them on the legend.
Any workaround for this?
Please let me know if anything is not clear.

Just found the answer.
I just need to replace the empty vectors with NaN and the legend entry will show up.
Thanks!

Related

seaborn unknown line on barchart

Below in the picture their is a brown barplot and on that plot their is a dark brown small line at the end.
Its not possible to post the exact code because its many thousands of line. So my question is what parameter could be coursing this?
Thank you
You have several values corresponding to the category f which are averaged together and the bar is the 95%CI around that mean.
If you want to hide the CI, pass ci=None to barplot()

DC.js Line Chart - no line being displayed

Need to display line in a line-chart , with the ability to move the tiles, to see a max bitrate value line, to see labels and axis pointers on hover, grouped with a table and time Slider.Y dimension needs to display "bitrate total" or "bitrate Avg" (as defined in code). X dimension needs to display 15 min interval in scope of weeks.
I can upload my data into a table but not into the line graph. I can see points on the graph using .renderDataPoints() but no lines.
I checked the data - could not find any null/NaN values being returned, not using any old version of colors.
The code can be found in https://jsfiddle.net/dani2011/bu2ag0f7/8/. Tried to replace my CSV with var data but nothing is being displayed at the moment in the fiddle. The code as whole is displayed in https://groups.google.com/forum/#!topic/dc-js-user-group/MEslyF2RWRI
Any help would be greatly appreciated.
Here's my go-to-answer for how to put data into a jsFiddle. Basically it's easiest to stick it in an unused tag in the HTML. bl.ocks.org / blockbuilder.org is easier for this.
Here's a fork of your fiddle with the data loaded that way:
http://jsfiddle.net/gordonwoodhull/bu2ag0f7/17/
I also had to remove the spaces from the column names, because those got d3.csv confused and caused the BITRATE calculations to fail.
There was also some stray code inside the renderlet which was failing with a complaint about dim not existing.
The main reason why data was not displaying was because the input groups were not producing usable aggregated data. Your data is very close together in time, so aggregating by week would aggregate everything.
The way to debug this is to put a breakpoint or a console.log before the chart initialization and look at the results of group.all()
In this case bitrateWeekMinIntervalGroupMove and minIntervalWeekBitrateGroup were returning an array with one key/value pair. No lines can be drawn with one point. :)
It looks like you originally wanted to aggregate by 15 minute intervals, so let's get that working.
For whatever reason, there are two levels of aggregation in crossfilter, the dimension level and the group level. The dimension will have first crack at generating a key, and then the group will further refine these keys.
Your min15 function will map each time-key to the 15-minute mark before it, but it needs data that is higher than 15 minutes in resolution. So let's put these groups on the dateDimension, which hasn't already been mapped to a lower resolution:
var minIntervalWeekBitrateGroup = dateDimension.group(min15).reduceSum(function (d) {
return +d.BITRATE
});
var bitrateWeekMinIntervalGroupMove = dateDimension.group(min15).reduce(
...
Great, now there are 30 data points. And it draws lines.
I made the dots a bit smaller :) because at 30 pixels it was hard to see the lines.
Zooming in using the range chart reveals more of lines:
There still seem to be glitches in the reduce function (or somewhere) because the lines drop to zero when you zoom in too far, but hopefully this is enough to get you moving again.
My fork of your fiddle: http://jsfiddle.net/gordonwoodhull/bu2ag0f7/25/

angular-nvd3 how to show data values for line chart

I want to create a LINE chart using angular-nvd3, with each data point has label on top and displaying the data value. I was able to find the option "showValues" and it can work for the discreteBarChart, but that options doesn't seem to work for line chart.
Any help? below is a picture of what I wanted. Update: i know that for a matter of fact the "showValues" is not in the LineChart. But is there any workaround.?

It's there any where to let lines in dc.js independent with each other

This is my first time to use "dc.js", but some troubles occurred as followed.
There are 6 lines in my line chart.But each line is added to its next line,so that the value on y axis can not describe the actual value of each line except the first.It's there any where for me to let these lines independent with each other? thanks!
Use a line series chart in dc.js 2.0, instead of a stacked line chart.
Example here:
http://dc-js.github.io/dc.js/examples/series.html
Code here:
https://github.com/dc-js/dc.js/blob/master/web/examples/series.html
Docs here:
https://github.com/dc-js/dc.js/blob/master/web/docs/api-latest.md#series-chart

Animating XY Line in TecPlot

I'm an environmental engineer using TecPlot to plot come charts with some input data, let me explain my problem.
I'm studying the evolution of a river bed with a Fortran code which I wrote. As a output the code gives a detailed stratigraphy going some centimeters under the soils surface. Basically the output file looks like this:
0.03500000000 -0.18093000000 -0.17093000000 -0.16093000000 -0.15093000000 ...
0.10500000000 -0.18100000000 -0.17100000000 -0.16100000000 -0.15100000000 ...
0.17500000000 -0.18107000000 -0.17107000000 -0.16107000000 -0.15107000000 ...
0.24500000000 ...
and so on.
The first column is the x variable (horizontal evolution) and has 200 data.
The other columns are the evolution on the vertical coordinate.
So basically for each line we have, starting from the second colon, an horizontal line drawn thanks to 400 values.
For example if I plot the entire first column with the entire first row what I get is just a line on the plot.
For each time step my Fortran code create an output file which gives a plot with all the substrate lines.
What I want to do, and I really don't know how to do it, is animating this plots in order to have, for each time step of the animation, the ENTIRE plot with ALL THE LINES.
What I've done in TecPlot so far is:
1) import all the output files
2) put them in the XY Line plot of TecPlot using one zone for each output file I have (file 1 -> 1:ZONE001, file 2 -> 2:ZONE001, file 3 -> 3:ZONE001 and so on)
3) trying to turn them into contour plot (no results)
3.2) trying to animate them with XY Line plot animation (too bad, it animates every single line...)
I hope that I've been enough thorough to let you helping me.
I would appreciate each contribution and I thank You for each -even short, small- answer.
Best regards
Assuming you have already loaded the file, and have multiple zones. you can animate the mappings by Animate -> Mappings.., As far as
trying to animate them with XY Line plot animation (too bad, it animates every single line...)
is concerned, you need Map Skip value more than 1, to skip the mappings (lines). The animation can be saved as video or image sequences from the same dialogue box, by pressing the small video button besides the play rewind and forward buttons enter image description here

Resources