d3 tick marks on integers only

The proper solution is to retrieve ticks using .ticks() method, filter them to keep only integers and pass them to .tickValues(): const yAxisTicks = yScale.ticks() .filter(tick => Number.isInteger(tick)); const yAxis = d3.axisLeft(yScale) .tickValues(yAxisTicks) .tickFormat(d3.format(‘d’)); For completeness here is explanation why other solutions are bad: @BoomShakalaka solution uses .tickSubdivide() method, which no longer exists. @cssndrx and … Read more

Rotating axes label text in 3D

As a workaround, you could set the direction of the z-label manually by: ax.zaxis.set_rotate_label(False) # disable automatic rotation ax.set_zlabel(‘label text’, rotation=90) Please note that the direction of your z-label also depends on your viewpoint, e.g: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D fg = plt.figure(1); fg.clf() axx = [fg.add_subplot(4,1,1+i, projection=’3d’) for i in range(4)] … Read more

How to display all minor tick marks on a semi-log plot

solution for matplotlib >= 2.0.2 Let’s consider the following example which is produced by this code: import matplotlib.pyplot as plt import matplotlib.ticker import numpy as np y = np.arange(12) x = 10.0**y fig, ax=plt.subplots() ax.plot(x,y) ax.set_xscale(“log”) plt.show() The minor ticklabels are indeed gone and usual ways to show them (like plt.tick_params(axis=”x”, which=”minor”)) fail. The first … Read more

techhipbettruvabetnorabahisbahis forumu