Coder Social home page Coder Social logo

figrid's People

Contributors

dougollerenshaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

alleninstitute

figrid's Issues

White space around figure

Thanks for making this useful package! I have a problem, when I make a plot it doesn't fill the entire figure. I get a white border around it, especially on the left and top.

Code:

fig = plt.figure(figsize=(7, 9), dpi=DPI)  
ax = {'panel_A': fg.place_axes_on_grid(fig, xspan=[0.1, 1], yspan=[0, 0.18]),
      'panel_B': fg.place_axes_on_grid(fig, xspan=[0.1, 1], yspan=[0.25, 0.5],
                                       dim=[1, n_columns + 1], wspace=0.3),
      'panel_C': fg.place_axes_on_grid(fig, xspan=[0.1, 1], yspan=[0.55, 0.8],
                                       dim=[1, n_columns + 1], wspace=0.3),
      'panel_D': fg.place_axes_on_grid(fig, xspan=[0.2, 0.45], yspan=[0.85, 1]),
      'panel_E': fg.place_axes_on_grid(fig, xspan=[0.55, 1], yspan=[0.85, 1])}

# Add subplot labels
labels = [{'label_text':'a', 'xpos':0, 'ypos':0, 'fontsize':10, 'weight': 'bold',
           'ha': 'right', 'va': 'bottom'},
          {'label_text':'b', 'xpos':0, 'ypos':0.2, 'fontsize':10, 'weight': 'bold',
           'ha': 'right', 'va': 'bottom'},
          {'label_text':'c', 'xpos':0, 'ypos':0.55, 'fontsize':10, 'weight': 'bold',
           'ha': 'right', 'va': 'bottom'},
          {'label_text':'d', 'xpos':0, 'ypos':0.85, 'fontsize':10, 'weight': 'bold',
           'ha': 'right', 'va': 'bottom'},
          {'label_text':'e', 'xpos':0.5, 'ypos':0.85, 'fontsize':10, 'weight': 'bold',
           'ha': 'right', 'va': 'bottom'}]
fg.add_labels(fig, labels)

As you can see here (hopefully) the figure doesn't start at the top left:

Figure_1

`sharex=True` does not work on an `Nx1` array of axes

When running this block of code:

import figrid as fg
import matplotlib.pyplot as plt

fig = plt.figure(figsize=(15,7))
axes = {
    'axis_array': fg.place_axes_on_grid(fig, xspan=[0, 1], dim=[3, 1], sharex=True)
}

I get:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [X], in <cell line: 6>()
      2 import matplotlib.pyplot as plt
      4 fig = plt.figure(figsize=(15,7))
      5 axes = {
----> 6     'axis_array': fg.place_axes_on_grid(fig, xspan=[0, 1], dim=[3, 1], sharex=True)
      7 }

File ~/.conda/envs/XX/lib/python3.9/site-packages/figrid/__init__.py:67, in place_axes_on_grid(fig, dim, xspan, yspan, wspace, hspace, sharex, sharey, frameon)
     65     inner_ax[row][col].xaxis.set_ticks_position('bottom')
     66 elif row < dim[0] and sharex == True:
---> 67     plt.setp(inner_ax[row][col].get_xtick)
     69 if col == 0 and sharey == True:
     70     inner_ax[row][col].yaxis.set_ticks_position('left')

AttributeError: 'AxesSubplot' object has no attribute 'get_xtick'

It looks like I need to deal with the case in which the inner_ax has only 1 col.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.