Plotly modify hovermode data - python-3.x

I have a data frame with columns ['run_id','timestamp','pass','fail','no_run'].
I am generating a stacked bar from it.
which looks like
Currently I am generating this stacked bar with x axis as timestamp and y axis as pass/fail/no_run.
The figure layout has hovermode as 'x'.
I would like a way to modify this graph so that when I hover on a bar, instead of showing timestamp in x axis, it should show 'run_id'.
I don't want to change the x axis to run_id while generating the bar chart, it has to be timestamp, but I need a way to modify this hover data.

Related

How to hold the value of a variable in excel bar graph?

I have a plot in excel bar graph as shown in the image. But I want the Y axis data to be held at it's value until the next discrete sample in X axis .i.e the value of Y axis is 160.8 at X=1, and I want this value to be held until X=2 where the value of Y changes to 2. How do I do this?
Edit 1 - I tried following this tutorial and it worked - https://trumpexcel.com/step-chart-in-excel/
But I had to format the X axis cells to date format. I want the same to work when X axis format is a number.

Permanently changing the range of the axes using matplotlib?

I have been using pandas, matplotlib and seaborn for data visualisation but I can't figure out how to permanently change the axes limits? I will show you what I mean below:
I want the y axis to go from 0 to 300 and the x axis from -4 to 4 (so that the background grid is complete, none of the squares are cut off).
In general I want the following:
Let the step on the y_axis be z (so 50 in the case above). Then, matplotlib automatically stops the y axis at y_max (maximum y value from the data).
This y_max lands in between kz and (k+1)z, for some positive integer k (in the case above, it lands between 250 and 300, so 5*50 and 6*50, so k=5). Now, I want the y axis to stop at (k+1)z and not y_max.
And similarly for the x-axis.
I know that I can set the y limits and x limits manually for each plot, but is there a way I can somehow permanently get matplotlib/pandas/seaborn to automatically create the figures in such a way?
I tried looking at the rcParams on matplotlib but couldn't really see anything of use.

Match order color and legend in stacked chart with negative values excel

[Problem]
In a very simple stacked bar graph in excel (example data below), the colors of the positive part of the chart match with the legend (i.e. yellow upper and grey lower in both stacked bars and legend). However, for the negative values the legend is inverse to the actual order of the stacked bar (i.e. blue upper and orange lower in the staked bar but the opposite in the legend).
[Unsuccessful tries]
This is regardless of the actual data in the cells (changing the data doesn't change the colors or the order).
I've tried both changing the last parameter of the formula, and changing the order of the legend manually in the menu desing > select data > move up/down. None of them works, since it changes both the order of the stacked bars and the legends at the same time, so the order keeps unmatched.
[Question]
My question is, how can I match the order of the colors of the staked bars and the legend also for the negative part of the chart?
Example data:
1 -5
2 -1
3 1
4 5

Rotating a plot in gnuplot

1-How can I rotate my plot so y would be the new x axis and vice versa?
2- Change the maximum value of y axis from 60 to 100.
The plot is created by this script in the terminal :
set palette grey
plot 'color_map.dat' matrix with image
You can exchange the x and y axes with the using modifier. (Just like for ordinary plots, except that for matrix data, columns 1 and 2 are not in your data file, but are inferred.)
plot 'color_map.dat' matrix using 2:1:3 with image
If you actually just want to change the maximum value on the y (new x) axis, you would use set xrange[:100]. But it sounds like you might actually want to scale the data itself, in which case you could use
plot 'color_map.dat' matrix using ($2/60.*100):1:3 with image
Try help plot matrix for more details.

How to change axis value labels orientation?

I have a chart in Excel; I need to change orientation of text labels in one of the axis programmatically. Ideas?
This will change the orientation of the X-axis tick labels.
ActiveChart.Axes(xlCategory).TickLabels.Orientation = 45 ' degrees
This is how to change the orientation of the axis title:
ActiveChart.Axes(xlCategory).AxisTitle.Orientation = 81 ' degrees
Have you ever tried recording macros? If not, you should! Looking at the resulting code is a great way to quickly learn this type of thing.
Layout tab (which appears when you have a chart selected) -> labels -> axis titles.
or
Right click the chart axis -> format axis -> Alignment
or
VBA solution as Jean-François Corbett pointed out

Resources