thanks to all for the replies. i am still having an issue with the log
scale of these plots. i am trying to hide the top and right axes of
the plot, since these should not be there when plotting a histogram or
a line plot. i use the following code:
import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['ps.useafm'] = True
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['pdf.fonttype'] = 42
plt.rcParams['font.size'] = 10
from mpl_toolkits.axes_grid.axislines import SubplotZero
fig = plt.figure(figsize=(5, 5), dpi=300)
ax = SubplotZero(fig, 1, 1, 1)
ax = fig.add_subplot(ax)
x = range(1, 11)
y = [5000, 900, 600, 500, 200, 110, 50, 20, 10, 5]
plt.plot(x, y, linewidth=1.5, c='k')
ax = plt.gca()
ax.set_yscale('log')
ax.axis["xzero"].set_visible(True)
# make other axis (bottom, top, right) invisible.
invisible = ["bottom", "top", "right"]
for n in invisible:
ax.axis[n].set_visible(False)
plt.savefig('test_logscale.pdf')
if i do this, the bottom x-axis labels disappear.
this only happens with SubplotZero -- which is needed to make the
irrelevant axes invisible, I think -- then the labels of the x-axis
disappear.
any idea how this can be fixed? i want those axes removed but i still
want the labels/ticks of the bottom x-axis to show.
thanks.
···
On 11/11/09, Gökhan Sever <gokhansever@...287...> wrote:
On Wed, Nov 11, 2009 at 4:25 PM, per freem <perfreem@...287...> wrote:
hi all,
I am trying to make a simple bar graph that has its yaxis scale set to
log. I use the following code:
import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['ps.useafm'] = True
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['pdf.fonttype'] = 42
plt.rcParams['font.size'] = 10
x = range(1, 11)
y = [5000, 900, 600, 500, 200, 110, 50, 20, 10, 5]
plt.figure(figsize=(5, 5), dpi=300)
plt.bar(x, y)
It should work scaling from within the bar()
plt.bar(x, y, log=True)
# plt.gca().set_yscale('log')
plt.savefig('test_logscale.pdf')
the problem is that the bar graphs do not appear -- instead, i simply
get horizontal lines around where the top of the bar graph should
appear. Any idea how to fix this?
also, sometimes the x axis disappears when i try this. thanks.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008
30-Day
trial. Simplify your report design, integration and deployment - and focus
on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
--
Gökhan