How to change the graph produced by shap.summary_plot - python

My goal is to change the aspect of the graph produced using the shap.summary_plot in Python.
For instance, taking the example from here
I would like to change the horizontal label from "SHAP value (impact on model output)" to a different text, and I would like to move the vertical bar "Feature Value" horizontally below the graph.
The source code of the function is here, but I have been struggling in understand how to get my goals. Any comment or suggestion is highly welcomed.
UPDATE:
A recent like on this question - thanks! - reminded me that I indeed managed to find a way, which I'll share on GitHub soon.

Related

Add labels to real-time signal plotting with Vispy

I am not familiar enough with Vispy. I did adapt this example for my use case, but I don't know how to modify it further to include the missing features.
I am trying to plot in real-time N-channels of data at the same scale. Using pyqtgraph, the interface looks like this:
And with vispy:
My goal is to match both backends, step by step. The difference for now are:
The order in Vispy is reversed (plot at the top on Vispy is the plot at the bottom on pyqtgraph)
Lack channel names
Lack Y-axis label
Lack X-Axis and X-Axis label
Lack of headroom top/bottom
I do not know how to solve any of those, how to further improve this backend. Any tips, guidance towards the correct, best function to use for this would be very helpful.
I was looking into visual.text, but the positioning seemed difficult. I did not know how to match the label in front of one of the plot.

Diagram to evaluate multiple metrics for different models

I want to use python to plot a diagram like the one in the image below. The purpose of it is to summarize the results of different models using multiple metrics to evaluate.
Is there a way to easily do it in Python, if not can someone refer me to the name of the diagram or a framework I can do it?
Thanks,
What you are trying to draw is called a radar chart.
matplotlib allows the drawing of such a chart.
The matplotlib example above is quite verbose and there may be other, simpler solutions out there. But hopefully, knowing the name of the type of chart will help you in your search. Best of luck!

Color area under graph in manim

I am following this tutorial for manim: https://talkingphysics.wordpress.com/2019/01/08/getting-started-animating-with-manim-and-python-3-7/. Under heading 7.0: Graphing functions, the example shows code for plotting sine and cosine functions.
I was wondering if I could also fill the area covered between, let's say, sine function and the x-axis from x_min to x_max. I realized that the used PlotFunctions class has following hierarchy: PlotFunctions -> GraphScene -> Scene -> Container -> object (where -> denotes child of). But in this entire chain of hierarchy, I do not see a config option such as fill_color that is present in VMobject.
I'm also not readily able to locate any code that helps in doing so, although I'm sure that some really easy 1 line code must exist since this is used in so many 3blue1brown videos. I would really appreciate some help with this!
You can check this github issue, it might be something your'e looking for.
It hasn't been merged onto the main branch so this could be a work-around for now.
After looking more into the code, I still don't see a 1-liner code per se but did find that to color the area under the graph, a set of riemann rectangles of very small width (~0.01) are used. This makes the graph look colored.
I used get_point_from_function() option to get the points and passed them to create a Polygon filled with colour.
you can check it here , look at def get_region()

How to create a very specific data diagram using Python

I would like to make a diagram in Python similar to the one shown below. From what I've seen so far, there is no a library that I could use directly. Can you suggest me where to start from, for example, would it be worth to improvise by stacking horizontally multiple subplots. Is there maybe a better approach?
Thanks!
I believe the name you're looking for is Parallel Coordinates Plot.
I'm sure Plotly supports it and there are tutorials online for other libraries as well.
Let me know if this helps.
Edit: and judging by this image from Plotly's docs your example image comes from there.

Plotting 2-D time-series data on one y-axis with two properties

I'm trying to plot EEG (electroencephalography) data (an array of nElectrodes by nTimepoints) in python. I want to create a plot representing each electrode on the y-axis and each time point on the x-axis, but I also want the amplitude response to be represented on the y-axis. Here's an example of what I want the graph to look like (sorry for the rubbish xkcd powerpointedness of the graph):
http://i.stack.imgur.com/9LPqF.png
I'm having difficulty working out how to do this, particularly getting my head around giving each 'electrode' the ability to overlap with other electrodes (making artefacts much easier to spot).
I would really appreciate any help, so thanks in advance!
Darren
So upon looking back at the suggestion from #sebix, the following link has a small section of plotting script at the end which seems to work well for what I want. Here's the link below:
http://matplotlib.org/1.2.1/examples/pylab_examples/mri_with_eeg.html
I've never used offsets or anything before so this is new territory for me! Thanks for the comments.

Categories

Resources