Xlsxwriter hide data series in scatter plot - python

I have used xlsxwriter to add various different data series (lines) to a plot. What I would like to do now is disable certain series by default but, still have the disabled series available to reenable when looking at the graph.
For example, in the following image, while xlsxwriter adds all the series as I want it to, I would also like to not show "Sample2" & "Sample3" while showing "Sample1" by default.
The only feature I have been able to find that does something similar would be the:
# Delete/hide series index 0 and 2 from the legend.
chart.set_legend({'delete_series': [0, 2]})
It appears to "delete" it more than hide it because if I try to toggle them back on they don't show up.
Maybe it's not possible through xlsxwriter but is there any other way I can implement this functionality?

I hope you're enjoying your stay here lmao.
Delete/hide series index 0 and 2 from the legend.
chart.set_legend({'delete_series': [0, 2]})
This work?
If not...
for Mac:
Click on the chart.
On the ribbon, click Chart Design and then click Select Data.
On the Chart Design tab, click Select Data
This selects the data range of the chart and displays the Select Data Source dialog box.
To edit a legend series, in the Legend entries (series) box, click the series you want to change. Then, edit the Name and Y values boxes to make any changes.
To rearrange a legend series, in the Legend entries (series) box, click the series you want to change and then select the alternate text or alternate text arrows.
Windows:
Right-click your chart, and then choose Select Data.
n the Legend Entries (Series) box, click the series you want to change.
Click Edit, make your changes, and click OK.
Changes you make may break links to the source data on the worksheet.
To rearrange a series, select it, and then click Move Up alternate text or Move Down alternate text.
You can also add a data series or remove them in this dialog box by clicking Add or Remove. Removing a data series deletes it from the chart—you can’t use chart filters to show it again.
If you want to rename a data series, see Rename a data series.
I hope this is helpful to you.

Related

Is it possible to display matplotlib plots in columns without using subplots?

I'm creating an HTML report with a lot of plots and corresponding tables. It's quite big, so it would be great if the user could copy/paste the plot title into Find In Page to quickly find the associated table(s).
This answer made me realise that's not possible and that printing the title to the screen would help.
However, I want to display the charts in 2 columns.
Is it possible to print the title, display a plot, print a title to the right, display a plot to the right, begin next column, and so on, without using plt.subplots()?
If not in matplotlib, are there any plotting packages that could do this?

Context menu to select data source in matplotlib subplots (Jupyter)

I'm trying to build a dynamically customizable plot in jupyter with matplotlib. I already have sliders where I can select how many subplots shall be shown (x*y). But now I want to fill these subplots with data. I have a fix set of data series, and would like to have a context menu when I do a right click on the subplot where I could select the data series that shall be displayed. But I can't find any solution how to pop up a windows on a subplot and return the selected series. Do you have any idea/example for me how to solve this?
Thanks and best regards!

How to delete a plot from chart space in pptx python?

I'd like to delete plot that is in the chart space. Does any one know how to do that with pptx python? Since there's option to delete plots in powerpoint GUI. Is there any way I can do that with python pptx?
I have four charts in a slide and I want to first store the shapes of plots and then delete the plots inside of the charts.
Reading the docs I found this paragraph that shows in more detail how plots work:
A plot is like a sub-chart, containing one or more series and drawn as
a particular chart type, like column or line. This distinction is
needed for charts that combine more than one type, like a line chart
appearing on top of a column chart. A chart like this would have two
plot objects, one for the series appearing as columns and the other
for the lines. Most charts only have a single plot and python-pptx
doesn’t yet support creating multi-plot charts, but you can access
multiple plots on a chart that already has them.
From your question I assume that you want to delete the plot to replace it with a new one. I suggest that you delete the series inside the existing plot and add to it the new series you need.

Why can't Excel "filter by color" on styles created by openpyxl?

I created an Excel workbook and worksheet using openpyxl.
I set the fill and font colour of some cells like this:
ws.cell(row=2, column=1).font = some_font_defined_earlier
ws.cell(row=2, column=1).fill = some_fill_defined_earlier
The font and fill are applied correctly and look great in Excel.
However, in the autofilter of row 1, I do not see the usual "Filter by Color" options that I typically see with coloured cells when they've been coloured in Excel.
Have I applied the styles in a wrong/different way?
How can I set the fill and font colour but also have Excel allow me to filter on the colours?
EDIT1:
To be clear, I have applied the autofilter using:
ws.auto_filter.ref = ws.dimensions
I see the autofilter on the values, but not the colours. Filter by Color is greyed out, even though many of the cells have colours.
It appears the answer to this is all in Excel, not in the Workbook. Excel seems to have some unpredictable behaviour with respect to Filter by Color being greyed out.
In my case, I had more than 10,000 rows and, as described in #4 of Tips & Tricks 120 - Filter by Color Drop Down Menu Greyed Out Problem, Filter by Color can just not work:
Also if first colored cell appears after approximately 10000 rows, Excel may not detect the color. To overcome this behavior, put a color
in the first cell and now it will enable the Filter by Color. Only
thing is that this colored cell will be extra in your filtered list.

Showing a table after rotating by 90 in wx-python

I have to display a table with multiple columns but only a single row. Displaying it in the normal way using wxGrid doesnt look appealing at all and makes it hard for the user to read. I want to know if there is any way in which I can flip the table and display its contents vertically? Also is there any other way to make the data more presentable?
Just label the rows with the column names and the make one column. Then you could scroll through it that way. You just need to call SetRowLabelValue(rowNum, label). You may find this tutorial helpful (see the end): http://www.blog.pythonlibrary.org/2010/04/04/wxpython-grid-tips-and-tricks/
You could use a ListBox, but then you'd lose the label information.

Categories