I've created a stacked bar chart using plotly and would like to order the categorical variables on the x-axis according to decreasing values, based on their corresponding total y value. What is the best way to do this? Thanks in advance!
Hard without seeing your code, so I'll presume you're using pandas with plotly.
If so, it would be:
df['Your_X_Series'].sort_values(ascending=False, inplace=True)
And then plot the series.
Related
After searching for a week, I finally decided to put my question here. My aim is to create a ssrs chart Y-Axis which contains three different scales like in the following screenshot:
Is this possible? I have a Datasource with different Series Groups, and for each of them I want a different scale in the chart. At the moment it looks like this:
For anyone with the same Struggle, I made it with chart areas. In the series of the chart i made three series for every diffrent value.
I have a chart composed with vconcat and layer. The layered plot is one of the blocks in the vertical concatenation, it plots two different datasets. There are two more blocks in the vconcat: one that has a different (third) dataset, and another that is a smaller version of one of the layers (used for brushing / zoom). The x scales of all the charts follow the selection via brush signal; the bottom chart sets the signal value via user interaction.
I would like to align the x-axes on all the vconcat chunks. The dataset of the mis-aligned one does not cover as much as the timeseries line (it starts and ends around where the vertical dashed lines are).
When zooming / brushing with the bottom chart, the axes align. When the chart first loads, each x-axis covers the extent of the matching dataset. I'd like the axes to cover the largest extent of all the layers / concat blocks.
I've tried using the resolve config, "shared" vs "independent" etc, with no success.
Not really an answer, but a hack to get the desired result. An accepted answer should be a vega-lite config solution.
I modified the mis-matched dataset to have the same first and last timestamp, which causes the scales to naturally align.
I have created a combination chart in excel which I am attempting to replicate within SSRS.
The chart shows three versions of 'success' plus the percentage 'failed'. (Please see image for more detail)
For one of the segments, i.e. success v2, I would like to then break this data down by how long it took to achieve success, as a percentage.
I've attempted changing my chart type a few times within SSRS and exploring the chart 'General Custom Attributes' however I haven't been able to get very far with figuring out how to link two pie/donut charts...your help would be invaluable!
Thanks
Charlotte
Welcome to SO!
This isn't really an answer but a list of things to look at/consider and too long to fit in a comment.
You need to look at the Chart Series properties, in particular the Custom Attributes related to 'Collected...'
This allows you to explode a section but as far as I know it only allows you to use values or a % lower than a specified threshold, not a particular section as you want. This migh work if the section you want to explode out is always the smallest but I guess you cannot guarantee that.
You might be able to get round this by adding another column to your dataset that always shows a high number for 'failure' and 'success x1' and a small number for 'success x2' but i'm not sure if you can define which field to explode on and visualise a different field, otherwise your main pie would look incorrect.
Alternatively you could just show two charts.
I am plotting a heatmap using seaborn and I spent the last day or so trying to adjust the width of the columns because currently they are very wide. From my own search I was to find ways to adjust the size of the heatmap, or the line separating the columns but not the columns themselves. Is this doable using seaborn or should I use another tool?
This is a simple command that I am using:
sns.heatmap(mydata, cmap='Reds')
Thanks!
So after spending more time on this I realized that I could do this easily using pheatmap. You will need to use "cellwidth" parameter to control the width. So for example, pheatmap(mydata, cellwidth = 100). This question was asked for pheatmap here [link] reduce width of columns on a heatmap.2 plot before, but I initially wanted to use seaborn to generate the heatmap. I am still interested to know whether seaborn has a way to control the width.
I'm assembling a set of charts that query the same data, but with differing filters. For some of the filtered datasets, there is limited data, and for the charts displaying that data their minimum value on the X-axis is simply set to the minimum value found in the dataset. For consistency, I would like to explicitly set those bounds to the parameters passed to the report, however unlike the Y-axis the X-axis seems to lack this capability. Are there options that I'm missing?
Thanks!
You should have no issues in setting an expression in the x-axis properties dialog box and as such using a parameter there also. I've done it and the links below provide some sense that the option is there.
Axis Properties Dialog Box, Axis Options
I suspect what they are talking about, or at least how you can do this as far as I know, is to use these parameters in the dataset itself as the x-axis will be set based on the dataset alone.
Whereas the vertical axis is, or at least can be, unbound to your values. I mean that you may have values in the positive but decide not to display them by forcing the chart to show only negatives, due to say a KPI that is needed.