data-visualization
How to add hatches to boxplots with sns.boxplot or sns.catplot
Iterate through each subplot / FacetGrid with for ax in g.axes.flat:. ax.patches contains matplotlib.patches.Rectangle and matplotlib.patches.PathPatch, so the correct ones must be used. Caveat: all hues must appear for each group in each Facet, otherwise the patches and hatches will not match. In this case, manual or conditional code will probably be required to correctly … Read more
Combine two Pyplot patches for legend
The solution is borrowed from the comment by CrazyArm, found here: Matplotlib, legend with multiple different markers with one label. Apparently you can make a list of handles and assign only one label and it magically combines the two handles/artists. import matplotlib.patches as mpatches import matplotlib.pyplot as plt import numpy as np x = np.linspace(0,1,11) … Read more
How to create a grouped bar chart in Altair?
Example of group bar chart I show a simplified example of Grouped Bar Chart from Altair’s documentation. You can also see the full documentation here. Basically, you have to specify x-axis Gender (F or M in each subplot), y-axis as Rating and Genre as Column. from altair import * import pandas as pd # create … Read more
Constrain aspect ratio in WindowsForms DataVisualization Chart
This is a good question but unfortunately there is no simple solution like locking the two Axes or setting one value.. Let’s start by looking at the relevant players: The Chart control has an inner Size called ClientSize, which is the Chart.Size minus the borders. Both sizes are measured in pixels. Inside there may be … Read more
Pre-projected geometry v getting the browser to do it (aka efficiency v flexibility)
If I use this D3 function, aren’t I still forcing the viewer’s browser to do a lot of data processing, which will worsen the performance? The point of pre-processing the data is to avoid this. Or am I overestimating the processing work involved in the d3.geoTransform() function above? Short Answer: You are overestimating the amount … Read more