GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • GR Framework
  • About the GR Framework
  • Python Package gr
  • gr Reference
  • gr.pygr Reference
  • gr.pygr.mlab Reference
  • gr3 Reference
  • grm Reference
  • Julia Package GR
  • C library GR
  • Rust crate gr
  • Tutorials
  • GRPlot
  • Examples

This view

  • Original page
  • New address

GeezerVison is showing gr-framework.org — Python Package gr — GR Framework 0.73.27 documentation

Python Package gr¶

Installation¶

GR is available on PyPI and we recommend installing it with pip:

pip install gr

This will automatically install both the GR runtime and the Python wrapper. You may need to install some additional dependencies on Linux:

  • Debian:

    apt install libxt6 libxrender1 libxext6 libgl1-mesa-glx libqt6widgets6

  • Ubuntu:

    apt install libxt6 libxrender1 libxext6 libglx-mesa0 libqt6widgets6

  • CentOS / Fedora / Rocky Linux:

    yum install libXt libXrender libXext mesa-libGL qt6-qtbase-gui

  • openSUSE:

    zypper install libXt6 libXrender1 libXext6 Mesa-libGL1 libQt6Widgets6

  • Arch Linux:

    pacman -S mesa qt6-base

Note: Depending on the Linux flavor you are using, the package names may differ from the ones mentioned here. This particularly applies to the Qt versions used.

On FreeBSD make sure to install the these packages:

pkg install libXt libXrender libXext mesa-libs qt6

For information on building the GR runtime yourself, see Building the GR Runtime.

Docker and other headless Linux systems¶

  • GR does not rely on X11 for its non-interactive output formats, so you will not need the dependencies listed above on a headless system.

  • GR3 uses GLX for OpenGL context creation, which requires a connection to an X server. If you are using a headless sytem, e.g. a Docker container, you can use Xvfb or similar tools to start an X server that can be used by GR3, although it may only provide software rendering.

Getting Started¶

After installing GR, you can try it out by creating a simple plot:

from gr.pygr import mlab
mlab.plot(range(100), lambda x: x**2)
_images/plot_demo1.png

Tutorials¶

You can find several tutorials on using GR in the Tutorials section.

Examples¶

You can find a collection of Python scripts using GR in the Examples section.

API Reference¶

The Python API for GR consists of:

  • gr Reference
    • Output Functions
      • polyline()
      • polymarker()
      • text()
      • fillarea()
      • cellarray()
      • shadepoints()
      • shadelines()
      • spline()
      • textext()
      • inqtextext()
      • axes()
      • grid()
      • verrorbars()
      • herrorbars()
      • polyline3d()
      • axes3d()
      • titles3d()
      • volume()
      • surface()
      • contour()
      • drawrect()
      • fillrect()
      • drawarc()
      • fillarc()
      • drawarrow()
      • drawimage()
      • mathtex()
      • path()
    • Attribute Functions
      • setlinetype()
      • setlinewidth()
      • setlinecolorind()
      • setmarkertype()
      • inqmarkertype()
      • setmarkersize()
      • inqmarkersize()
      • setmarkercolorind()
      • inqmarkercolorind()
      • settextfontprec()
      • setcharexpan()
      • settextcolorind()
      • setcharheight()
      • setcharup()
      • settextpath()
      • settextalign()
      • setfillintstyle()
      • setfillstyle()
      • setfillcolorind()
      • setcolorrep()
      • setcolormap()
      • setcolormapfromrgb()
      • setarrowstyle()
      • setshadow()
      • settransparency()
      • setresamplemethod()
      • inqresamplemethod()
      • setbordercolorind()
      • inqbordercolorind()
      • setborderwidth()
      • inqborderwidth()
    • Transformation Functions
      • setscale()
      • inqscale()
      • setwindow()
      • inqwindow()
      • setviewport()
      • selntran()
      • setclip()
      • setwswindow()
      • setwsviewport()
      • setspace()
      • inqspace()
      • setcoordxform()
      • setprojectiontype()
      • inqprojectiontype()
      • setperspectiveprojection()
      • inqperspectiveprojection()
      • setorthographicprojection()
      • inqorthographicprojection()
      • settransformationparameters()
      • inqtransformationparameters()
      • camerainteraction()
      • setwindow3d()
      • inqwindow3d()
      • setscalefactors3d()
      • inqscalefactors3d()
    • Control Functions
      • clearws()
      • updatews()
      • beginprint()
      • beginprintext()
      • endprint()
      • begingraphics()
      • endgraphics()
      • updategks()
      • opengks()
      • closegks()
      • inqdspsize()
      • openws()
      • closews()
      • activatews()
      • deactivatews()
      • emergencyclosegks()
  • gr.pygr Reference
    • CoordConverter
      • CoordConverter.getNDC()
      • CoordConverter.getScale()
      • CoordConverter.getWC()
      • CoordConverter.getWindow()
      • CoordConverter.setNDC()
      • CoordConverter.setScale()
      • CoordConverter.setWC()
      • CoordConverter.setWCforPlotAxes()
      • CoordConverter.setWindow()
      • CoordConverter.window
    • Coords2D
      • Coords2D.setUpdateXCallback()
      • Coords2D.setUpdateYCallback()
      • Coords2D.x
      • Coords2D.y
    • Coords2DList
      • Coords2DList.TYPE
      • Coords2DList.append()
      • Coords2DList.extend()
      • Coords2DList.insert()
      • Coords2DList.pop()
      • Coords2DList.remove()
      • Coords2DList.updateMinMax()
    • Coords3D
      • Coords3D.z
    • Coords3DList
      • Coords3DList.TYPE
      • Coords3DList.updateMinMax()
    • DeviceCoordConverter
      • DeviceCoordConverter.getDC()
      • DeviceCoordConverter.setDC()
    • ErrorBar
      • ErrorBar.HORIZONTAL
      • ErrorBar.VERTICAL
      • ErrorBar.direction
      • ErrorBar.dneg
      • ErrorBar.dpos
      • ErrorBar.drawGR()
      • ErrorBar.x
      • ErrorBar.y
    • GridCoords3D
    • Plot
      • Plot.addAxes()
      • Plot.addROI()
      • Plot.autoscale
      • Plot.drawGR()
      • Plot.getAxes()
      • Plot.getROI()
      • Plot.isLegendEnabled()
      • Plot.logXinDomain()
      • Plot.logYinDomain()
      • Plot.offsetXLabel
      • Plot.offsetYLabel
      • Plot.pan()
      • Plot.pick()
      • Plot.reset()
      • Plot.select()
      • Plot.setGrid()
      • Plot.setLegend()
      • Plot.setLegendWidth()
      • Plot.setLogX()
      • Plot.setLogY()
      • Plot.sizex
      • Plot.sizey
      • Plot.subTitle
      • Plot.title
      • Plot.viewport
      • Plot.xlabel
      • Plot.ylabel
      • Plot.zoom()
    • PlotAxes
      • PlotAxes.COORDLIST_CLASS
      • PlotAxes.COUNT
      • PlotAxes.OPTION
      • PlotAxes.SCALE_X
      • PlotAxes.SCALE_Y
      • PlotAxes.addCurves()
      • PlotAxes.autoscale
      • PlotAxes.backgroundColor
      • PlotAxes.curveDataChanged()
      • PlotAxes.curveVisibilityChanged()
      • PlotAxes.doAutoScale()
      • PlotAxes.drawGR()
      • PlotAxes.getBoundingBox()
      • PlotAxes.getCurves()
      • PlotAxes.getId()
      • PlotAxes.getVisibleCurves()
      • PlotAxes.getWindow()
      • PlotAxes.isGridEnabled()
      • PlotAxes.isReset()
      • PlotAxes.isXDrawingEnabled()
      • PlotAxes.isXLogDomain()
      • PlotAxes.isYDrawingEnabled()
      • PlotAxes.isYLogDomain()
      • PlotAxes.majorx
      • PlotAxes.majory
      • PlotAxes.plot()
      • PlotAxes.reset()
      • PlotAxes.scale
      • PlotAxes.scaleWindow()
      • PlotAxes.setGrid()
      • PlotAxes.setLogX()
      • PlotAxes.setLogY()
      • PlotAxes.setWindow()
      • PlotAxes.setXDrawing()
      • PlotAxes.setXtickCallback()
      • PlotAxes.setYDrawing()
      • PlotAxes.setYtickCallback()
      • PlotAxes.ticksize
      • PlotAxes.xtick
      • PlotAxes.ytick
    • PlotContour
      • PlotContour.drawGR()
      • PlotContour.h
      • PlotContour.majorh
    • PlotCurve
      • PlotCurve.COUNT
      • PlotCurve.drawGR()
      • PlotCurve.errorBar1
      • PlotCurve.errorBar2
      • PlotCurve.legend
    • PlotSurface
      • PlotSurface.colormap
      • PlotSurface.drawGR()
      • PlotSurface.option
    • Point
      • Point.norm()
      • Point.x
      • Point.y
    • RegionOfInterest
      • RegionOfInterest.LEGEND
      • RegionOfInterest.TEXT
      • RegionOfInterest.append()
      • RegionOfInterest.isPointInside()
      • RegionOfInterest.reference
      • RegionOfInterest.regionType
      • RegionOfInterest.x
      • RegionOfInterest.y
    • Text
      • Text.DEFAULT_CHARHEIGHT_FACTOR
      • Text.charexpan
      • Text.charheight
      • Text.charup
      • Text.drawGR()
      • Text.getBoundingBox()
      • Text.halign
      • Text.hideviewport
      • Text.setFont()
      • Text.text
      • Text.textcolor
      • Text.textpath
      • Text.valign
    • delay()
    • isinstanceof()
    • islistof()
    • ndctowc()
    • readfile()
    • wctondc()
  • gr.pygr.mlab Reference
    • Output Functions
      • Line Plots
        • plot()
        • oplot()
        • step()
        • plot3()
        • polar()
      • Scatter Plots
        • scatter()
        • scatter3()
      • Quiver Plots
        • quiver()
      • Stem Plots
        • stem()
      • Bar Plots
        • bar()
      • Histograms
        • histogram()
        • polar_histogram()
        • hexbin()
      • Contour Plots
        • contour()
        • contourf()
        • tricont()
      • Surface Plots
        • surface()
        • trisurf()
        • wireframe()
      • Heatmaps
        • heatmap()
        • shade()
      • Images
        • imshow()
      • Isosurfaces
        • isosurface()
      • Volume Rendering
        • volume()
    • Attribute Functions
      • title()
      • legend()
      • xlabel()
      • ylabel()
      • zlabel()
      • dlabel()
      • xlim()
      • ylim()
      • zlim()
      • xlog()
      • ylog()
      • zlog()
      • xflip()
      • yflip()
      • zflip()
      • rotation()
      • tilt()
      • colormap()
    • Control Functions
      • figure()
      • subplot()
      • savefig()
      • hold()
  • gr3 Reference
    • General Functions
      • init()
      • terminate()
      • getrenderpathstring()
      • geterrorstring()
      • setlogcallback()
    • Scene Description Functions
      • clear()
      • cameralookat()
      • setcameraprojectionparameters()
      • setlightdirection()
      • setbackgroundcolor()
      • createmesh()
      • createindexedmesh()
      • createisosurfacemesh()
      • drawmesh()
      • deletemesh()
      • drawconemesh()
      • drawcylindermesh()
      • drawspheremesh()
      • createsurfacemesh()
      • drawmesh_grlike()
      • drawsurface()
      • surface()
    • Export and Drawing Functions
      • getimage()
      • drawimage()
      • export()
      • setquality()
    • Interaction Functions
  • grm Reference
    • Basic functions
    • Argument Container
      • new()
      • _ArgumentContainer
        • _ArgumentContainer.clear()
        • _ArgumentContainer.contains()
        • _ArgumentContainer.delete()
        • _ArgumentContainer.ptr
        • _ArgumentContainer.push()
        • _ArgumentContainer.remove()
        • _ArgumentContainer.update()
    • Event system
      • EVENT_MERGE_END
      • EVENT_NEW_PLOT
      • EVENT_SIZE
      • EVENT_UPDATE_PLOT
      • EventType
      • register()
      • unregister()
    • Interaction module
      • get_box()
      • input()
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.