Bizarre clipping of title when markers used

I haven't been able to reproduce yet in a minimal example, but in this
code, if markers are used in the plot, then the title is clipped off and
not shown. If the markers= is commented out, then the title is fine. I
know it's clipped, because if I specify
set_title ('blah', y=0.5) < set y to something < .95
Then the title is displayed (but in the wrong position).

So, if markers are present, title is clipped off. No markers, title is
fine.

My code is here (you can't run it I'm afraid):

matplotlib=2.2.2

import pandas as pd

def do_plot(other_csv, mine_xlsx, name):
    df_tdla_96 = pd.read_csv (other_csv)
    df_tdla_96_mine = pd.read_excel (mine_xlsx)
    df_tdla_96_mine = df_tdla_96_mine[['esno_corrected', 'per']]
    df_tdla_96_mine.rename (index=str, columns={'esno_corrected' : 'SNR',
'per' : 'Hughes'}, inplace=True)
    df_tdla_96.drop(labels='Hughes', inplace=True, axis=1)
    df_tdla_96_merge = pd.merge(left=df_tdla_96, right=df_tdla_96_mine,
on='SNR')
    from matplotlib.lines import Line2D
    from itertools import cycle
    m_cycle = cycle(Line2D.filled_markers)
    import matplotlib.pyplot as plt
    fig, ax = plt.subplots()#, sharex=True)
    for company in df_tdla_96_merge.columns[1:]:
        df = df_tdla_96_merge[['SNR', company]]
        ax.semilogy(df['SNR'], df[company], marker='x')
    ax.set_title('Simple plot')
    #ax.set_title('blah', fontsize=12, y=0.95)
    # ax.set_xlabel('SNR')
    # ax.set_ylabel('BLER')
    # ax.legend(loc='best')
    #fig.suptitle('blah', fontsize=12, x=0.5, y=0.9)
    ax.grid()
    #plt.tight_layout()
    plt.show()

    #plt.tight_layout()
    #plt.savefig('tdla_96.pdf')

do_plot('tdla_96_other.csv', 'tdla_96_mrc_wiener.xlsx', 'TDLA 96 CP-OFDM')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180608/8498c94a/attachment.html>

Neal Becker wrote:

I haven't been able to reproduce yet in a minimal example, but in this
code, if markers are used in the plot, then the title is clipped off and
not shown. If the markers= is commented out, then the title is fine. I
know it's clipped, because if I specify
set_title ('blah', y=0.5) < set y to something < .95
Then the title is displayed (but in the wrong position).

So, if markers are present, title is clipped off. No markers, title is
fine.

My code is here (you can't run it I'm afraid):

matplotlib=2.2.2

import pandas as pd

def do_plot(other_csv, mine_xlsx, name):
    df_tdla_96 = pd.read_csv (other_csv)
    df_tdla_96_mine = pd.read_excel (mine_xlsx)
    df_tdla_96_mine = df_tdla_96_mine[['esno_corrected', 'per']]
    df_tdla_96_mine.rename (index=str, columns={'esno_corrected' : 'SNR',
'per' : 'Hughes'}, inplace=True)
    df_tdla_96.drop(labels='Hughes', inplace=True, axis=1)
    df_tdla_96_merge = pd.merge(left=df_tdla_96, right=df_tdla_96_mine,
on='SNR')
    from matplotlib.lines import Line2D
    from itertools import cycle
    m_cycle = cycle(Line2D.filled_markers)
    import matplotlib.pyplot as plt
    fig, ax = plt.subplots()#, sharex=True)
    for company in df_tdla_96_merge.columns[1:]:
        df = df_tdla_96_merge[['SNR', company]]
        ax.semilogy(df['SNR'], df[company], marker='x')
    ax.set_title('Simple plot')
    #ax.set_title('blah', fontsize=12, y=0.95)
    # ax.set_xlabel('SNR')
    # ax.set_ylabel('BLER')
    # ax.legend(loc='best')
    #fig.suptitle('blah', fontsize=12, x=0.5, y=0.9)
    ax.grid()
    #plt.tight_layout()
    plt.show()

    #plt.tight_layout()
    #plt.savefig('tdla_96.pdf')

do_plot('tdla_96_other.csv', 'tdla_96_mrc_wiener.xlsx', 'TDLA 96 CP-OFDM')

It appears adding ax.set(clip_on=False) fixes it, but this bug seems very
strange.

Neal,

Can you reproduce this with random data? From which side is the text
clipped?

Tom

···

On Fri, Jun 8, 2018 at 8:18 AM Neal Becker <ndbecker2 at gmail.com> wrote:

Neal Becker wrote:

> I haven't been able to reproduce yet in a minimal example, but in this
> code, if markers are used in the plot, then the title is clipped off and
> not shown. If the markers= is commented out, then the title is fine. I
> know it's clipped, because if I specify
> set_title ('blah', y=0.5) < set y to something < .95
> Then the title is displayed (but in the wrong position).
>
> So, if markers are present, title is clipped off. No markers, title is
> fine.
>
> My code is here (you can't run it I'm afraid):
>
> matplotlib=2.2.2
>
> import pandas as pd
>
> def do_plot(other_csv, mine_xlsx, name):
> df_tdla_96 = pd.read_csv (other_csv)
> df_tdla_96_mine = pd.read_excel (mine_xlsx)
> df_tdla_96_mine = df_tdla_96_mine[['esno_corrected', 'per']]
> df_tdla_96_mine.rename (index=str, columns={'esno_corrected' : 'SNR',
> 'per' : 'Hughes'}, inplace=True)
> df_tdla_96.drop(labels='Hughes', inplace=True, axis=1)
> df_tdla_96_merge = pd.merge(left=df_tdla_96, right=df_tdla_96_mine,
> on='SNR')
> from matplotlib.lines import Line2D
> from itertools import cycle
> m_cycle = cycle(Line2D.filled_markers)
> import matplotlib.pyplot as plt
> fig, ax = plt.subplots()#, sharex=True)
> for company in df_tdla_96_merge.columns[1:]:
> df = df_tdla_96_merge[['SNR', company]]
> ax.semilogy(df['SNR'], df[company], marker='x')
> ax.set_title('Simple plot')
> #ax.set_title('blah', fontsize=12, y=0.95)
> # ax.set_xlabel('SNR')
> # ax.set_ylabel('BLER')
> # ax.legend(loc='best')
> #fig.suptitle('blah', fontsize=12, x=0.5, y=0.9)
> ax.grid()
> #plt.tight_layout()
> plt.show()
>
> #plt.tight_layout()
> #plt.savefig('tdla_96.pdf')
>
> do_plot('tdla_96_other.csv', 'tdla_96_mrc_wiener.xlsx', 'TDLA 96
CP-OFDM')

It appears adding ax.set(clip_on=False) fixes it, but this bug seems very
strange.

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180610/f20b117f/attachment.html>

Sorry, got busy on other things. The title seems to be clipped by the top
axis. Maybe I can make a screenshot.

···

On Sun, Jun 10, 2018 at 11:21 AM Thomas Caswell <tcaswell at gmail.com> wrote:

Neal,

Can you reproduce this with random data? From which side is the text
clipped?

Tom

On Fri, Jun 8, 2018 at 8:18 AM Neal Becker <ndbecker2 at gmail.com> wrote:

Neal Becker wrote:

> I haven't been able to reproduce yet in a minimal example, but in this
> code, if markers are used in the plot, then the title is clipped off and
> not shown. If the markers= is commented out, then the title is fine. I
> know it's clipped, because if I specify
> set_title ('blah', y=0.5) < set y to something < .95
> Then the title is displayed (but in the wrong position).
>
> So, if markers are present, title is clipped off. No markers, title is
> fine.
>
> My code is here (you can't run it I'm afraid):
>
> matplotlib=2.2.2
>
> import pandas as pd
>
> def do_plot(other_csv, mine_xlsx, name):
> df_tdla_96 = pd.read_csv (other_csv)
> df_tdla_96_mine = pd.read_excel (mine_xlsx)
> df_tdla_96_mine = df_tdla_96_mine[['esno_corrected', 'per']]
> df_tdla_96_mine.rename (index=str, columns={'esno_corrected' :
'SNR',
> 'per' : 'Hughes'}, inplace=True)
> df_tdla_96.drop(labels='Hughes', inplace=True, axis=1)
> df_tdla_96_merge = pd.merge(left=df_tdla_96, right=df_tdla_96_mine,
> on='SNR')
> from matplotlib.lines import Line2D
> from itertools import cycle
> m_cycle = cycle(Line2D.filled_markers)
> import matplotlib.pyplot as plt
> fig, ax = plt.subplots()#, sharex=True)
> for company in df_tdla_96_merge.columns[1:]:
> df = df_tdla_96_merge[['SNR', company]]
> ax.semilogy(df['SNR'], df[company], marker='x')
> ax.set_title('Simple plot')
> #ax.set_title('blah', fontsize=12, y=0.95)
> # ax.set_xlabel('SNR')
> # ax.set_ylabel('BLER')
> # ax.legend(loc='best')
> #fig.suptitle('blah', fontsize=12, x=0.5, y=0.9)
> ax.grid()
> #plt.tight_layout()
> plt.show()
>
> #plt.tight_layout()
> #plt.savefig('tdla_96.pdf')
>
> do_plot('tdla_96_other.csv', 'tdla_96_mrc_wiener.xlsx', 'TDLA 96
CP-OFDM')

It appears adding ax.set(clip_on=False) fixes it, but this bug seems very
strange.

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180612/7aafc7f3/attachment.html>

Looks like I can't reproduce it now

···

On Tue, Jun 12, 2018 at 9:34 AM Neal Becker <ndbecker2 at gmail.com> wrote:

Sorry, got busy on other things. The title seems to be clipped by the top
axis. Maybe I can make a screenshot.

On Sun, Jun 10, 2018 at 11:21 AM Thomas Caswell <tcaswell at gmail.com> > wrote:

Neal,

Can you reproduce this with random data? From which side is the text
clipped?

Tom

On Fri, Jun 8, 2018 at 8:18 AM Neal Becker <ndbecker2 at gmail.com> wrote:

Neal Becker wrote:

> I haven't been able to reproduce yet in a minimal example, but in this
> code, if markers are used in the plot, then the title is clipped off
and
> not shown. If the markers= is commented out, then the title is fine.
I
> know it's clipped, because if I specify
> set_title ('blah', y=0.5) < set y to something < .95
> Then the title is displayed (but in the wrong position).
>
> So, if markers are present, title is clipped off. No markers, title is
> fine.
>
> My code is here (you can't run it I'm afraid):
>
> matplotlib=2.2.2
>
> import pandas as pd
>
> def do_plot(other_csv, mine_xlsx, name):
> df_tdla_96 = pd.read_csv (other_csv)
> df_tdla_96_mine = pd.read_excel (mine_xlsx)
> df_tdla_96_mine = df_tdla_96_mine[['esno_corrected', 'per']]
> df_tdla_96_mine.rename (index=str, columns={'esno_corrected' :
'SNR',
> 'per' : 'Hughes'}, inplace=True)
> df_tdla_96.drop(labels='Hughes', inplace=True, axis=1)
> df_tdla_96_merge = pd.merge(left=df_tdla_96, right=df_tdla_96_mine,
> on='SNR')
> from matplotlib.lines import Line2D
> from itertools import cycle
> m_cycle = cycle(Line2D.filled_markers)
> import matplotlib.pyplot as plt
> fig, ax = plt.subplots()#, sharex=True)
> for company in df_tdla_96_merge.columns[1:]:
> df = df_tdla_96_merge[['SNR', company]]
> ax.semilogy(df['SNR'], df[company], marker='x')
> ax.set_title('Simple plot')
> #ax.set_title('blah', fontsize=12, y=0.95)
> # ax.set_xlabel('SNR')
> # ax.set_ylabel('BLER')
> # ax.legend(loc='best')
> #fig.suptitle('blah', fontsize=12, x=0.5, y=0.9)
> ax.grid()
> #plt.tight_layout()
> plt.show()
>
> #plt.tight_layout()
> #plt.savefig('tdla_96.pdf')
>
> do_plot('tdla_96_other.csv', 'tdla_96_mrc_wiener.xlsx', 'TDLA 96
CP-OFDM')

It appears adding ax.set(clip_on=False) fixes it, but this bug seems
very
strange.

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180612/6b519844/attachment.html>