Bizarre clipping of title when markers used

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Bizarre clipping of title when markers used

Neal Becker
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')


_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Bizarre clipping of title when markers used

Neal Becker
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
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Bizarre clipping of title when markers used

tcaswell
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 <[hidden email]> 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
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Bizarre clipping of title when markers used

Neal Becker
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 <[hidden email]> 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 <[hidden email]> 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
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Bizarre clipping of title when markers used

Neal Becker
Looks like I can't reproduce it now

On Tue, Jun 12, 2018 at 9:34 AM Neal Becker <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users