{"id":13398289,"url":"https://github.com/matplotlib/trendvis","last_synced_at":"2025-06-29T13:03:07.898Z","repository":{"id":28483201,"uuid":"31999308","full_name":"matplotlib/trendvis","owner":"matplotlib","description":null,"archived":false,"fork":false,"pushed_at":"2022-11-07T23:18:32.000Z","size":403,"stargazers_count":115,"open_issues_count":2,"forks_count":15,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-06-04T06:38:03.985Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matplotlib.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-11T05:03:16.000Z","updated_at":"2024-11-29T15:21:17.000Z","dependencies_parsed_at":"2023-01-14T08:54:17.224Z","dependency_job_id":null,"html_url":"https://github.com/matplotlib/trendvis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/matplotlib/trendvis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matplotlib%2Ftrendvis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matplotlib%2Ftrendvis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matplotlib%2Ftrendvis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matplotlib%2Ftrendvis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matplotlib","download_url":"https://codeload.github.com/matplotlib/trendvis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matplotlib%2Ftrendvis/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259431677,"owners_count":22856576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T19:00:21.908Z","updated_at":"2025-06-29T13:03:07.675Z","avatar_url":"https://github.com/matplotlib.png","language":"Python","readme":"========\nTrendVis\n========\n\nTrendVis is a plotting package that uses\n`matplotlib \u003chttp://matplotlib.org/\u003e`_ to create information-dense,\nsparkline-like, quantitative visualizations of multiple disparate data sets in\na common plot area against a common variable.  This plot type is particularly\nwell-suited for time-series data. The results speak for themselves:\n\n.. image:: https://raw.githubusercontent.com/mscross/scipy_proceedings/trendvis/papers/mellissa_cross_t/barredplot.png\n    :target: https://raw.githubusercontent.com/mscross/scipy_proceedings/trendvis/papers/mellissa_cross_t/barredplot.png\n    :alt: TrendVis example\n\nFor further reading on TrendVis, see the `SciPy 2015 Proceedings \u003chttp://conference.scipy.org/proceedings/scipy2015/mellissa_cross_t.html\u003e`_.\n\n============\nInstallation\n============\n\nTrendVis is pure Python, natively supports Python 2 and 3, and depends only on\n`matplotlib \u003chttp://matplotlib.org/\u003e`_ version 1.2 or greater.\n\nSetup and installation is simple::\n\n    pip install -U trendvis\n\nor, if you would like to develop the package, fork and clone the repo then run::\n\n    python setup.py develop\n\nat package root.\n\n==============\nQuick Examples\n==============\n\nBelow are several examples showing various features in TrendVis and a typical\nworkflow. Version \u003e= 0.2.1 is required.\n\nSingle column ``XGrid``\n-----------------------\n\n.. code-block:: python\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    import trendvis\n\n    # Pseudorandom data and plot attributes\n    random_generator = np.random.RandomState(seed=123)\n    yvals = random_generator.rand(10)\n\n    # Plot attributes\n    nums = 10\n    lw = 1.5\n\n    # convenience function trendvis.gridwrapper() is available\n    # to initialize XGrid and do most of the formatting shown here\n    ex0 = trendvis.XGrid([1,2,1], figsize=(5,5))\n\n    # Convenience function for plotting line data\n    # Automatically colors y axis spines to\n    # match line colors (auto_spinecolor=True)\n    trendvis.plot_data(ex0,\n        [[(np.linspace(0, 9.5, num=nums), yvals, 'blue')],\n         [(np.linspace(1, 9, num=nums), yvals*5, 'red')],\n         [(np.linspace(0.5, 10, num=nums), yvals*10, 'green')]],\n        lw=lw, markeredgecolor='none', marker='s')\n\n    # Get rid of extra spines\n    ex0.cleanup_grid()\n    ex0.set_spinewidth(lw)\n\n    ex0.set_all_ticknums([(2, 1)], [(0.2, 0.1), (1, 0.5), (2, 1)])\n    ex0.set_ticks(major_dim=(7, 3), minor_dim=(4, 2))\n\n    ex0.set_ylabels(['stack axis 0', 'stack axis 1', 'stack axis 2'])\n\n    # In XGrid.fig.axes, axes live in a 1 level list\n    # In XGrid.axes, axes live in a nested list of [row][column]\n    ex0.axes[2][0].set_xlabel('Main Axis', fontsize=14)\n\n    # Compact the plot\n    ex0.fig.subplots_adjust(hspace=-0.3)\n\n.. image:: https://cloud.githubusercontent.com/assets/2184487/8859118/f4706b72-3140-11e5-9351-5182977a991c.png\n    :target: https://cloud.githubusercontent.com/assets/2184487/8859118/f4706b72-3140-11e5-9351-5182977a991c.png\n    :alt: Single column XGrid\n\nTwo-row ``YGrid`` with frame\n----------------------------\n\n.. code-block:: python\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    import trendvis\n\n    # Pseudorandom data\n    random_generator = np.random.RandomState(seed=1234)\n    xvals = random_generator.rand(20)\n\n    # Plot attributes\n    numpts = 20\n    lw = 1.5\n\n    # Initialize a YGrid\n    ex1 = trendvis.YGrid([1, 2, 1], yratios=[1, 2], figsize=(5,5))\n\n    # Convenience function\n    trendvis.plot_data(ex1,\n        [[(xvals, np.linspace(2, 18.5, num=numpts), 'blue')],\n         [(xvals*5, np.linspace(1, 17, num=numpts),  'red')],\n         [(xvals*10, np.linspace(0.5, 20, num=numpts), 'green')]],\n        lw=lw, auto_spinecolor=True, markeredgecolor='none', marker='s')\n\n    # Remove extra spines, color stack (y) ticks\n    ex1.cleanup_grid()\n    ex1.set_spinewidth(lw)\n\n    # Tick, tick label formatting\n    ex1.set_all_ticknums([(0.2, 0.1), (1, 0.5), (2, 1)], [(2, 1), (2, 1)])\n    ex1.set_ticks(major_dim=(7, 3), minor_dim=(4, 2))\n    ex1.set_ylim([(0, 15, 20), (1, 0, 11)])\n\n    # Axes labels\n    ex1.set_xlabels(['stack axis 0', 'stack axis 1', 'stack axis 2'])\n    ex1.axes[0][0].set_ylabel('Main Axis 0', fontsize=14)\n    ex1.axes[2][1].set_ylabel('Main Axis 1', fontsize=14,\n                  rotation=270, labelpad=14)\n\n    # Draw boxes around each row\n    ex1.draw_frame()\n\n    # Broken axis cutout marks also available, try this instead of the frame:\n    # ex0.draw_cutout(di=0.05)\n\n    # Compact the plot\n    ex1.fig.subplots_adjust(wspace=-0.3)\n\n.. image:: https://cloud.githubusercontent.com/assets/2184487/8859244/b07c0f9c-3141-11e5-8c1c-7d20f77ce7ee.png\n    :target: https://cloud.githubusercontent.com/assets/2184487/8859244/b07c0f9c-3141-11e5-8c1c-7d20f77ce7ee.png\n    :alt: Two-column YGrid\n\nThree-column ``XGrid`` with advanced features\n---------------------------------------------\n\n.. code-block:: python\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    import trendvis\n\n    # Make some pseudorandom data\n    random_generator = np.random.RandomState(seed=123)\n    yvals = random_generator.rand(40)\n    yvals1 = np.copy(yvals)\n    yvals1[20:] = np.array([0.2, 0.3, 0.2, 0.5, 0.34, 0.24,\n                0.15, 0.23, 0.26, 0.21] * 2)\n    numpts = 40\n    lw = 1.5\n    x0 = np.linspace(2, 49.5, num=numpts)\n    x1 = np.linspace(1, 49, num=numpts)\n    x11 = np.linspace(1.5, 47.5, num=numpts)\n    twin0 = np.linspace(2, 50, num=numpts)\n    twin1 = np.linspace(0.5, 48, num=numpts)\n\n    # Initialize XGrid and twin axes\n    ex2 = trendvis.XGrid([3, 4], xratios=[1, 3, 2], figsize=(5, 5),\n                         startside='right')\n    ex2.make_twins([0, 1])\n\n    # Convenience function\n    trendvis.plot_data(ex2,\n        [[(x0, yvals, 'blue')],\n         [(x1, yvals1*5, 'red'), (x11, yvals1*5.2, 'orchid')],\n         [],\n         [(twin1, yvals*2, '0.5')]],\n        lw=lw, marker=None)\n\n    # Adjust twinned y-axis positions for readability\n    ex2.move_spines(twin_shift=0.6)\n\n    # For any other kind of plot (fill_between, scatter, errorbar, etc),\n    # get axis and plot directly\n    # Note: ex2.axes[2][2] == ex2.get_axis(0, xpos=2, is_twin=True)\n    for ax in ex2.axes[2]:\n        ax.fill_between(twin0, yvals+0.075, yvals-0.1,\n                        edgecolor='none', color='darkorange')\n\n    # Handle axis ticks\n    ex2.cleanup_grid()\n    ex2.set_spinewidth(lw)\n    ex2.autocolor_spines()\n    ex2.set_all_ticknums([(2, 1), (2, 1), (2, 1)],\n                         [(0.2, 0.1), (1, 0.5), (1, 0.25), (0.5, 0.25)])\n    ex2.set_ticks(major_dim=(6, 1.5), minor_dim=(3, 1))\n\n    ex2.set_ylabels(['row 0', 'row 1', 'twin row 0', 'twin row 1'])\n\n    # Rotate x-axis tick labels\n    for ax in ex2.fig.axes:\n        plt.setp(ax.xaxis.get_majorticklabels(), rotation=45)\n\n    # Draw a vertical bar behind the data - horizontal bars available too\n    ex2.draw_bar(ex2.axes[1][2], ex2.axes[0][2], (45, 47), color='lightblue')\n\n    # Ok to set axis limits after drawing on figure using TrendVis methods,\n    # TrendVis will reset the bar to the right place!\n    ex2.set_xlim([(0, 0, 3), (1, 13, 24), (2, 43, 50)])\n    ex2.set_ylim([(2, 0, 2)])\n\n    # matplotlib annotations supported\n    ex2.get_axis(0).text(0, 0.75, 'Text')\n\n    # Cutouts instead of frames\n    ex2.draw_cutout(lw=lw)\n\n    # Set the suptitle and compact the plot\n    ex2.fig.suptitle('Title', fontsize=16, y=1.05);\n    ex2.fig.subplots_adjust(hspace=-0.1)\n\n.. image:: https://cloud.githubusercontent.com/assets/2184487/8860699/097e51fa-314b-11e5-93e5-eb158aa5b801.png\n    :target: https://cloud.githubusercontent.com/assets/2184487/8860699/097e51fa-314b-11e5-93e5-eb158aa5b801.png\n    :alt: Three-column XGrid with advanced features\n\n===========================\nExamples in Published Works\n===========================\n*Great Basin hydrology, paleoclimate, and connections with the North Atlantic: A speleothem stable isotope and trace element record from Lehman Caves, NV* by Mellissa Cross, David McGee, Wallace S. Broecker, Jay Quade, Jeremy D. Shakun, Hai Cheng, Yanbin Lu, and R. Lawrence Edwards.  doi:`10.1016/j.quascirev.2015.06.016 \u003chttps://doi.org/10.1016/j.quascirev.2015.06.016\u003e`_\n    Figures 2, 3, 4, 5, and panels 1 and 2 in figure 6 made with TrendVis.\n    \nAdditional references to works containing TrendVis figures are welcome!\n    \n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatplotlib%2Ftrendvis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatplotlib%2Ftrendvis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatplotlib%2Ftrendvis/lists"}