Install Plotly in Anaconda

If you don’t care which version of Plotly you install, just use pip. pip install plotly is an easy way to install the latest stable package for Plotly from PyPi. pip is a useful package and dependency management tool, which makes these things easy, but it should be noted that Anaconda’s conda tool will do the same thing. pip will install … Read more

Scatter plot colorbar – Matplotlib

You’re passing in specific rgb values, so matplotlib can’t construct a colormap, because it doesn’t know how it relates to your original data. Instead of mapping the values to RGB colors, let scatter handle that for you. Instead of: Do: (Just pass in to c what you were originally passing into plt.cm.jet.) Then you’ll be … Read more

Remove xticks in a matplotlib plot?

The plt.tick_params method is very useful for stuff like this. This code turns off major and minor ticks and removes the labels from the x-axis. Note that there is also ax.tick_params for matplotlib.axes.Axes objects.

Changing the “tick frequency” on x or y axis in matplotlib

You could explicitly set where you want to tick marks with plt.xticks: For example, (np.arange was used rather than Python’s range function just in case min(x) and max(x) are floats instead of ints.) The plt.plot (or ax.plot) function will automatically set default x and y limits. If you wish to keep those limits, and just change the stepsize of the tick marks, then you could use ax.get_xlim() to discover what limits Matplotlib … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)