C/C++ source code visualization? [closed]

Doxygen is really excellent for this, although you will need to install GraphViz to get the the graphs to draw. Once you’ve got everything installed, it’s really rather simple to draw the graphs. Make sure you set EXTRACT_ALL and CALL_GRAPH to true and you should be good to go. The full documentation on this function … Read more

Change ggplot factor colors

The default colours are evenly spaced hues around the colour wheel. You can check how this is generated from here. You can use scale_fill_manual with those colours: p + scale_fill_manual(values=c(“#F8766D”, “#00BA38″)) Here, I used ggplot_build(p)$data from cyl to get the colors. Alternatively, you can use another palette as well like so: p + scale_fill_brewer(palette=”Set1”) And … Read more

How to display a 3D plot of a 3D array isosurface in matplotlib mplot3D or similar?

Just to elaborate on my comment above, matplotlib’s 3D plotting really isn’t intended for something as complex as isosurfaces. It’s meant to produce nice, publication-quality vector output for really simple 3D plots. It can’t handle complex 3D polygons, so even if implemented marching cubes yourself to create the isosurface, it wouldn’t render it properly. However, … Read more

How to plot a histogram using Matplotlib in Python with a list of data?

If you want a histogram, you don’t need to attach any ‘names’ to x-values because: on x-axis you will have data bins on y-axis counts (by default) or frequencies (density=True) import matplotlib.pyplot as plt import numpy as np %matplotlib inline np.random.seed(42) x = np.random.normal(size=1000) plt.hist(x, density=True, bins=30) # density=False would make counts plt.ylabel(‘Probability’) plt.xlabel(‘Data’); Note, … Read more

Colorize Voronoi Diagram

The Voronoi data structure contains all the necessary information to construct positions for the “points at infinity”. Qhull also reports them simply as -1 indices, so Scipy doesn’t compute them for you. https://gist.github.com/pv/8036995 http://nbviewer.ipython.org/gist/pv/8037100 import numpy as np import matplotlib.pyplot as plt from scipy.spatial import Voronoi def voronoi_finite_polygons_2d(vor, radius=None): “”” Reconstruct infinite voronoi regions in … Read more

Why do many examples use `fig, ax = plt.subplots()` in Matplotlib/pyplot/python

plt.subplots() is a function that returns a tuple containing a figure and axes object(s). Thus when using fig, ax = plt.subplots() you unpack this tuple into the variables fig and ax. Having fig is useful if you want to change figure-level attributes or save the figure as an image file later (e.g. with fig.savefig(‘yourfilename.png’)). You … Read more

How can I make a barplot and a lineplot in the same seaborn plot with different Y axes nicely?

You can use twinx() method along with seaborn to create a seperate y-axis, one for the lineplot and the other for the barplot. To control the style of the plot (default style of seaborn is darkgrid), you can use set_style method and specify the preferred theme. If you set style=None it resets to white background … Read more