Can't create custom labels with XlsxWriter - python

I am trying to add custom data Labels into a "column chart" with the XlsxWriter version: 1.2.1.
No matter what, it never displays custom labels but always the current values.
Like this chart with current values:
I already tried to copy some example code from here:
Chart data label position is ignored for custom data labels · Issue #754
The chart should look like this:
But when I execute it, it shows up like this:
Does somebody have any solution? Is it because of the version?
P.S. I'm working on my work computer in the office — that's why I can't update the library that easily.
Thanks!

Support for custom data labels was added in XlsxWriter version 1.3.2. It wasn't supported in the version you have (1.2.1). So you will need to upgrade the library version to at least 1.3.7 but preferably to the latest version.

Related

Scatterplot in seaborn 0.8

I'm on a remote server where I have access to seaborn=0.8.1 and have no way of updating the package. I'd like to use seaborn.scatterplot, but I'm getting an error that the function does not exist.
Either the function did not exist in the older version, or it had a different name. I am unable to find earlier versions of the documentation (numpy does a great job of providing manuals for earlier versions), so I am kind of stuck here.
How do I find out the API for earlier versions of seaborn, and whether there are older alternatives to scatterplot?
You can use the GitHub repo to find documentation of older versions - just navigate to the correct tag that corresponds to your version, and enter the doc directory -
https://github.com/mwaskom/seaborn/tree/v0.8.1/doc
It's very common for documentation to be stored alongside the code and versioned along with it.
It seems the scatterplot function was added in 0.9 to seaborn/relational.py, which has the line:
__all__ = ["relplot", "scatterplot", "lineplot"], so "seaborn.scatterplot" gets "created" when seaborn/__init__.py performs from .relational import *.
I'm not sure if there's a similar function in v0.8.1. A quick search shows that class class _RegressionPlotter(_LinearPlotter) has a method called scatterplot in version 0.8.1, but I don't think it's the same (not familiar enough with Seaborn to know).

How to change HighCharts theme using Python ezhc?

I have been using ezhc package, it is a very useful tool to manipulate highcharts object using Python.
But I have desperately tried to change the themes of the Highcharts graph I am producing, based on the demo notebook found on Github link
Anything I have tried is unsuccessful, it seems that this part of the code, which should override globaloptions of all the charts, does not work as expected:
hc_global = hc.GlobalOptions(th.themes['dark-unica'])
hc_global.inject(verbose=True)
I see the js hc_global.js seems to be correctly created, but does not override the globalOptions of the chart. The visual of the chart output after is unchanged, no matter what theme is chosen
Am I doing something wrong? Does anybody successfully ran the example notebook and observed the theme change?
Thanks a lot for your help

Where can I find all the properties for customization in matplotlib?

I'm trying to create my own style, like 'ggplot', and I'm looking for a dictionary or a guide where I can find all the customizable properties. At the end of this page of the documentation of matplotlib there is a file called 'matplotlibrc' and i want to know if that files contains all the possible options on customization or there is something else.
Yes, the example file contains all possible parameters. This file is embedded into each documentation built; and there is a test that ensures that whenever a new parameter is added or removed, this file is updated. So you can consider it being complete.
However, make sure to always refer to the version of the documentation that corresponds to your matplotlib version.
The most up to date version at any time is at
https://matplotlib.org/tutorials/introductory/customizing.html
while for example the version of matplotlib 3.0.3 would be available through
https://matplotlib.org/3.0.3/tutorials/introductory/customizing.html

How to export Ecoinvent 3.5 Database with brightway2 to GEXF file?

I would like to Export a brightway2 database to a gexf file to visualize it with Gephi, like here:
https://chris.mutel.org/visualizing-ecoinvent.html
When I try to Export it, I get a KeyError.
my code is:
import brightway2 as bw
from bw2io.export.gexf import DatabaseToGEXF
gephi = DatabaseToGEXF("ecoinvent 3.5 cutoff")
gephi.export()
Can someone help me with that?
This would be more properly filed as a bug report.
This bug was fixed in 0.7.6, released today via the normal channels. However, the previous visualization you linked to was built on the categories present in ecoinvent version 2. Version 3 no longer has these categories (though other similar metadata is possible). Moreover, the linked visualization required a lot of manual work (especially for the labelling).
So, creating a similar visualization for a recent ecoinvent is possible, but not easy :) My guess is you would have to write a custom DatabaseToGEXF subclass that will export the metadata you are interested in using for graph clustering/coloring/etc.

Semi-Interactive Pandas Dataframe in a GUI

There are a number of excellent answers to this question GUIs for displaying dataframes, but what I'm looking to do is a bit more advanced.
I'd like to display a dataframe, but have a couple of the columns be interactive where the user can manually overwrite values (and the rest be static). It would be useful to have "total" rows that change with the overwritten values and eventually have some interactive buttons around the dataframe for loading and clearing data.
QTPandas looks promising, but appears to be dead as it is build off of a really old version of Pandas (0.17.1). Can this be done in QT? Is something else better?
I love Rstudio as my IDE as I can not only view all objects created but I can also edit data in the IDE itself. There are many other great features too.
And you can use R Studio for Python coding too (using reticulate package).
Spyder too gives this feature of viewing or editing the data frame.
However, if you're looking for a dedicated GUI with drag & drop features, you can use Pandas GUI.
Features of pandasgui are:
View DataFrames and Series (with MultiIndex support)
Interactive plotting
Filtering
Statistical summary
Data editing and copy / paste
Import CSV files with drag & drop Search toolbar
It's first version was released in Mar 2019 & still developing. As of date, you can't use it in Colab
While not a GUI in itself, XLWings leveraged Excel as a GUI and makes pandas dataframes interactive for users and was our library of choice.

Categories

Resources