Matplotlib - align centre monthly width barchart without overlap - date

I'm plotting two sets of monthly values on one figure, one in line format, the other in bars.
I want to bars to be one month wide so that there are no gaps between them, and the ticks, points, and bars to all be centred. I can do this, but the bars then overlap slightly due to the differing lengths of the months (largest difference obviously seen in Feb-Mar)
Is there some sort of hack to get around this?
Thanks!

Related

Grafana how can I make sure two plots' x-axis aligned perfectly

I have two plots queried from InfluxDB that share the same timestamps.
But as you can see in the pictures that because the y-axis label of the bottom graph takes up more space the two plots misaligned in the timestamp.
I would really like to be able to plot these two sets of data perfectly aligned so I can see how one affects the other.
Can you advice how I can achieve that ? Or being able to make a subplot that is draw two time series plots in one panel, sharing the x-axis would also be great.

Measure distance between two columns in echarts

I am using echarts for my graph and I have a requirement for displaying 25th quartile, median, average, 50 and 75 quartiles like below.
While it works in most cases, My problem is the line labels collide in cases where there is no sufficient distance between two lines hence the reason why I display the median label on top of average above. Currently I determine this by the number of columns between consecutive lines, while this work, it doesn't in a situation where the number of columns are many and still the distance between two lines is not sufficient for the labels. I am wondering is there is way to measure the px distance between two columns in echarts ? For example column A --> B has the width of 18px . Any help will be appreciated.

How to plot different data in parallel (in continuation of the previous one)

I have some energy 24 hour consumption data of many days.
Plotting a specific day gives me vertical axis of consumption and horizontal axis of time.
I would like to plot for lets say 1 year.
If I use "hold on/off" command, it plots all days together on top of each other.
How can i plot in a way that for the second day, the plots goes to the continue of the first plot (horizontal axis extends automatically)? So, when I have the complete plot, it shows 365 days of energy consumption based on hour. It's like the horizontal axis is repeating while the vertical axis is updating. I'm talking about MATLAB.
You can still use hold on and plot each day separately (if I understand your question properly, this is what you want, separate plotting). Simply make sure your x-axis values are correct. So e.g. if you have one measurement value per hour, the plot day 1:
plot(1:24,valDay1,'k-')
then for day 2:
plot(25:48,valDay2,'r-')
etc. This will line things up correctly. Also, consider using a datetime as x axis values
So, I found my solution which is very simple. I don't know how it didn't occur earlier.
I just had to use ";" and that's it.
Like this:
DAY=[day1;day2;day3]
plot(DAY)

Tableau Control Chart - Attribute measure incorrect

All
I have a control chart, with on the X-axis a time period, and the Y-axis the value of the measure (I'd like to plot all the points in a control chart).
However, I have 2 different values as a measure, which have the exact same date (up to a second match) but different measure values.
When I plot this on a control chart, instead of having 2 points in the control chart with value 500 and 550 for example - it gives me one point with a value of about 200.
It also gives a notification that there is a NULL value in this axis, which points to the X-axis where 2 records have the exact same date.
Any idea what I can do to make this correct - or make tableau draw the measure points correctly?
Thanks in advance!
It's difficult to answer without seeing more detail about your problem, but this sounds like a good candidate for a blended axis. (multiple measures sharing a single axis)
The easiest way to do this is to put your (probably continuous) datetime field on the row axis and one of your measures on the row axis to see one of then control plots. Then drag the second measure to the Y-axis until you see a little translucent two bar icon to indicate that you are adding a second measure to that axis, at which point you can release the pointer and you should see a two plots on the same axis.
If the scales for the two measures are radically different, you can instead drag the second measure to the right side instead to get a dual axis.

Bar graph x-axis titles do not work with many bars

I'm using MATLAB and I want a bar plot.
I plotted the bars, and then give titles to the bars.
If I only using 10 bars it works (see pic1).
But often I need more, mostly 32 bars (see pic2).
In this case the titles are not under the bars. I found out that MATLAB don't overlap the titles. The max value is 15 bars.
Does anyone knows how I can get MATLAB to overlap the titles?
Here is my code for plotting the bars:
y = absSlopes(1, 1:size(absSlopes,2));
hb = bar(y);
set(gca,'XTickLabel',titles);
rotateXLabels(gca, 45);
ylabel('Anzahl');
absSlopes is a matrix and I use the complete first line.
You may want to try XTick in addition to XTickLabel. At least for regular plots you can enforce specific spacings through this setting.
You can do this by an additional setup-command:
set(gca,'XTickLabel',titles);
set(gca,'XTick',absSlopes(1,:));
Of course, you can set both properties in the same line, but I like to keep it simple in case you want to deactiviate/comment one or the other setting later on.