Sudden change in the plot format - python-3.x

About more than a month ago, I realized the plots I was getting from my code have a different format altogether (background not white anymore, grid added, fonts changed, legend affected). I looked and could not find any changes that could have affected the default format of my plots.
Does anyone know if this is a change they made to matplotlib (3.1.1)? Also, is there a way to fix this (preferably without having to define every characteristic of the plot all over)?

Related

Can I disable the scientific notification in pyqtgraph labeltext?

Is it possible to disable the unit for the axis label text? The x-axis shows the time as it should be. The text in the x-axis shows "Messzeitpunkt" but with the, i think, scientific notification afterwards "(x1e+09)". I already tried to set the unit explicit to "None" but this didn't work. Screenshot from plot

How to add a background picture for a figure in matplotlib

I'm trying to add a background picture to go the full size of the figure but I'm not being able to do so. For some reason, when I try to add the background picture it get's added to one of the subplots but never the whole figure.
I have a Figure that contains 4 subplots each containing pie charts, but when I add it replaces one of them.
If not, is it possible to add a logo and any position I want Instead of a background picture?

Excel chart (scatter plot) - X axis line behaves strangely

I've noticed this issue a couple of times over the past few years, even now that I've moved from Excel 2013 to Excel 2016 and have a different computer.
I produce a scatter plot, and set the axis line colors to black. Everything thing works as expected. Then I make a change to the underlying data, and the X axis line appears in the wrong place. As shown in the image below, the X axis line appears to be equal to around 4%, rather than 0% as you would expect. (To emphasize, the black lines are not data that is being plotted, but the result of formatting the axis lines to black).
If I close and re-open Excel file, or display it on a different screen, the issue resolves! The image below is exactly the same chart (and data) as shown above, but after I moved the open workbook from my primary monitor to my secondary monitor. Now the X axis line is where you would expect it to be!
Has anyone experienced this issue before, and any idea what causes it? I find it strange that it occurs on both new and older versions of Excel, different versions of Windows, and on different machines.
Thank you very much for your time,
Steve

Vaadin SVGConversor date format

I am using Vaadin charts from vaadin 7.7.6. When I create a chart where I have several values obtained in different dates, the chart is created correctly. Here I put an image of the obtained result where each value is a pair to be represented.
The issue comes, when I want to convert this chart to a PDF file or create a web service that returns this chart as an image to be included elsewhere.
For creating an image from the chart, I use the SVGGenerator as recommended in the documentation. In general, it works really fine and I am able to create PDFs with charts inside. But with this chart I have an issue if the X axis is using dates. Here I copy the chart after converted to SVG:
(I have removed some chart controls as the Navigation and the Range selector because are useless in an image or PDF).
At the image we can observe that now in the X axis the dates are not showed correctly. I have checked for several hours the issue, and I am pretty sure that the issue is related to the SVGConversor.
Reading the SVGConversor code, I found a withLang(String lang) method. My thought was that maybe, if I set the language, the date is showed correctly (something similar to localization). I am not able to found any documentation of the value needed to this function and therefore, I have tried some values such as en, en_EN, en-EN, English, .... But does not matter the value I put there, always this error is launched:
java.lang.RuntimeException: SVG generation failed: ReferenceError: Can't find variable: en
Still, I am not sure that the withLang(String lang) method is the solution to my issue.
The question is: How can I show the correct dates in the X axis of my chart when converted to SVG?
Seems that the solution at the end was really easy. The issue is that I have not set the xAxis type. It is not a problem when using the chart in a Vaadin view, but it is mandatory for the SVGConverter to know the axis. Then adding this line of code:
chart.getConfiguration().getxAxis().setType(AxisType.DATETIME);
Fix the issue with the SVGConverter. Now the chart is represented correctly in my PDF documents.

Integrating charts in Excel

I was wondering if there is a way to integrate a bar chart and a line chart into "one single chart", where the bars are "on top of the line plot? See picture for a clearer view.
(Obviously the bar-chart is not supposed to be outside the actual plot...)
This is a bit of a hack, but you could create two charts with the chart area fill transparency turned to 100%. This allows charts to be placed on top of each other, but in a way that both can be seen. Turning off any elements in the chart that you don't want (for example, duplicate axis) would enhance the presentation.
Problem solved. It was actually just a matter of scaling data, and using two "line with markers" type charts. The lines in between each dot in the one showing the percentage, were then removed. Then, using a certain layout, a line connecting the two series could appear (as shown in pic).

Resources