logo
down
shadow

Why minor ticks disappear on pylab subplots


Why minor ticks disappear on pylab subplots

Content Index :

Why minor ticks disappear on pylab subplots
Tag : python-2.7 , By : ArmHead
Date : November 26 2020, 01:01 AM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Matplotlib log colorbar minor ticks disappear when range is less than a decade


Tag : development , By : John Phipps
Date : March 29 2020, 07:55 AM
wish helps you Matplotlib colorbars don't seem to do minor ticks in log scale. Using the method in this answer works, though it's a bit inconvenient - one day this will be automatic, but for now you have to organise the minor tick values by hand (np.arange(2, 10)/10. in this case, but you'd have to append np.arange(2, 10) if your values went up to 10)
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm

# fill grid
x = np.linspace(1,10,10)
y = np.linspace(1,10,10)

X, Y = np.meshgrid(x,y)
# Z = np.abs(X + Y)
Z = np.abs(X/10 + Y/10)

# plot
f, ax = plt.subplots()
p = plt.pcolormesh(X, Y, Z, norm=LogNorm(), vmin=2e-1, vmax=1)
cb = plt.colorbar(p, ax=ax)

# cb.ax.minorticks_on()

# We need to nomalize the tick locations so that they're in the range from 0-1...
minorticks = p.norm(np.arange(2, 10)/10.)
cb.ax.yaxis.set_ticks(minorticks, minor=True)

plt.show()

Zedgraph - last minor ticks disappear


Tag : chash , By : noboruwatanabe
Date : March 29 2020, 07:55 AM
it should still fix some issue Looks like this an issue in the Axis.DrawMinorTics method.
Axis values are doubles, and XDate uses lets say days as its base unit, 2011,2,5 and 2011,2,5,0,0,5 are converted to doubles as 40579.0 and 40579.000057870522
var start = new XDate(2011, 2, 5);
pane.XAxis.Scale.Min = new XDate(2011, 2, 5, 0, 0, 0, 0) - start;
pane.XAxis.Scale.Max = new XDate(2011, 2, 5, 0, 0, 5, 0) - start;

x-ticks disappear when plotting on subplots sharing x-axis


Tag : python , By : user135518
Date : November 09 2020, 03:01 PM
help you fix your problem There are two options. One is based on the answer to this question: matplotlib - pandas - No xlabel and xticks for twinx axes in subploted figures which is to reverse the order of plotting. First plot to the two subplots, then create the twin axes for both.
import matplotlib.pyplot as plt
import pandas as pd

fig, axes = plt.subplots(nrows=2, ncols=1)
data=pd.DataFrame([[1,2,3],[2,3,4],[3,2,4]])

ax=axes[0]
y=pd.DataFrame(data.iloc[:,0]-data.iloc[:,1])
data.plot(ax=ax)

ax3=axes[1]
y=pd.DataFrame(data.iloc[:,0]-data.iloc[:,1])
data.plot(ax=ax3)

ax2=ax.twinx()
ax2.plot(y.values)
ax4=ax3.twinx()
ax4.plot(y.values)

plt.show()
[t.set_visible(True) for t in ax.get_xticklabels()]
import matplotlib.pyplot as plt
import pandas as pd


fig, axes = plt.subplots(nrows=2, ncols=1)
data=pd.DataFrame([[1,2,3],[2,3,4],[3,2,4]])

ax=axes[0]
y=pd.DataFrame(data.iloc[:,0]-data.iloc[:,1])
ax2=ax.twinx()
data.plot(ax=ax)
ax2.plot(y.values)

ax3=axes[1]
y=pd.DataFrame(data.iloc[:,0]-data.iloc[:,1])
ax4=ax3.twinx()
data.plot(ax=ax3)
ax4.plot(y.values)

[t.set_visible(True) for t in ax.get_xticklabels()]

plt.show()

matplotlib colorbar minor ticks color and number of minor ticks


Tag : python , By : fedorafennec
Date : March 29 2020, 07:55 AM
Hope that helps I have a matplotlib (v2.1.1) plot that includes a colorbar. When plotted on a figure with a white background, I get a colorbar as shown in one of the attached images. That is fine (though I'd love to know how to set the number of minor ticks). , You may use rcParams to set the required colors.
import matplotlib.pyplot as plt

background = 0
if background == 0:
  back_color='black'
  fore_color='white'
else:
  back_color='white'
  fore_color='black'

plt.rcParams["text.color"] = fore_color
plt.rcParams["axes.labelcolor"] = fore_color
plt.rcParams["xtick.color"] =  fore_color
plt.rcParams["ytick.color"] = fore_color

fig, ax = plt.subplots()
fig.patch.set_facecolor(back_color)
im = ax.imshow([[1e5,2e5],[0.1e5,1e5]])
ax.axis( 'off' )  # don't show the axes ticks/lines/etc. associated with the image
cb = plt.colorbar(im)
cb.formatter.set_scientific(True)
cb.formatter.set_powerlimits((0,0))

cb.ax.minorticks_on()
cb.update_ticks()
plt.show()
import matplotlib.pyplot as plt

background = 0
if background == 0:
    plt.style.use("dark_background")

fig, ax = plt.subplots()

im = ax.imshow([[1e5,2e5],[0.1e5,1e5]])
ax.axis( 'off' )
cb = plt.colorbar(im)
cb.formatter.set_scientific(True)
cb.formatter.set_powerlimits((0,0))

cb.ax.minorticks_on()
cb.update_ticks()
plt.show()

Matplotlib won't show minor ticks when using subplots


Tag : python , By : user122937
Date : March 29 2020, 07:55 AM
will help you With pyplot the danger is that you loose track of which one the current axes is that a command like plt.minorticks_on() operates on. Hence it would be beneficial to use the respective methods of the axes you're working with:
ax1.minorticks_on()
ax2.minorticks_on()
Related Posts Related QUESTIONS :
  • My grammar stops on an embedded '/' . I tried adding it as an allowed value but it isn't working
  • Intersection of a set and list of dictionaries
  • Python write stdout to log file
  • Text alignment issue in Listbox
  • How to use related fields (fields.related) in odoo-8?
  • Why is my output in such a high dimension?
  • Handle possible null values in python dictionary
  • Colour intensity while Overlaying images in OPEN CV Python
  • Python smbus lib with Sensirion SGP30
  • Possible to configure synchronous "fire and forget" tasks with Ansible?
  • defined function not found
  • RNN regression using Tensorflow?
  • Working with two's complement in Python
  • Finding connected components using OpenCV
  • Python - How to use adapter interfaces
  • Amazon RDS python boto
  • How to convert 5 stars rating to pixels in python?
  • Accessing parent class method error
  • 'Figure' object has no attribute 'vbar'
  • Pandas qcut binning returning only one group
  • Pythononly pings 1 out of 2 IP's (Subprocess)
  • Subprocess "python file.py" – how to ensure runs in python3?
  • Yolk crashes when PyPi package descriptions contain certain characters
  • CSV reader issue
  • Logging fail in Appengine
  • How to get each subfolder size seperatly using Python?
  • Clean messy data with varying deliniator from a text file
  • Tensorflow RNN training won't execute?
  • update dictionary values with for loop
  • Export a KMeans model using export_savedmodel to deploy on ml-engine
  • OpenCV Brightness & Contrast like in Gimp
  • Why does returning an outside function give an error?
  • Python IndentationError - Lambda backup
  • Cant make multiple copies of a file using shutil python
  • "heat.stack.list()" to list all stack within the openstack "admin" cred
  • python PyUserInput import error
  • how to scrape some tags using Beautifulsoup on python
  • Onchange not working when data is inserted through python
  • Remove track from playlist with soundcloud Python
  • 403 "Request had insufficient authentication scopes" when creating drafts in Google API with Python
  • Scrapy crawling issue
  • How to debug if conditions in a C homework assignment?
  • Change fontsize of colorbars in matplotlib
  • Plotting a line with list in an equation
  • Is there a way to search a python dictionary using a wild character in python 2.7?
  • Is there a way to comment on a track using Soundcloud Python?
  • Memory error while generating the openstreet map tiles from generate_tiles.py
  • How to remove odoo from this browser tab?
  • Parseval's Theorem does not hold for FFT of a sinusoid + noise?
  • Best way to decode command line inputs to Unicode Python 2.7 scripts
  • The error was: error while evaluating conditional
  • Creating probability by value from a dict
  • Python CSV Line counts are Off
  • HTTP Deadline exceeded waiting for python Google Cloud Endpoints on python client localhost
  • kairosdb aggregate group by
  • Find Element Using XPath
  • which widget is used to sort column-wise data in tkinter GUI Python 2.7
  • Changing column width from excel files
  • Why is pyplot having issues with PyQt4's QThread?
  • Odoo 10 search active and inactive records using search() method
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com