Skip to main content

A fork of mpldxf - a matplotlib backend to write DXF drawings. Modified by NGI to handle geotechnical plots

Project description

Matplotlib Backend for DXF

Overview

This is a Matplotlib backend that enables Matplotlib to save figures as DXF drawings. DXF is a drawing format commonly used by Computer-Aided Design (CAD) tools.

This package builds on the ezdxf package by Manfred Moitzi: ezdxf on Bitbucket

Installation of dependencies

The package dependencies can be installed with uv

uv sync --upgrade
source .venv/bin/activate

Usage

To use this backend, you first need to register it with Matplotlib:

import matplotlib
from mpldxf import backend_dxf

# Matplotlib registration takes a FigureCanvas *class* (no kwargs), so use the
# factory to configure options like subplot sub-blocks.
FigureCanvas = backend_dxf.make_figure_canvas(use_fm_layers=False, use_subplot_blocks=True)
matplotlib.backend_bases.register_backend("dxf", FigureCanvas)

Then, you can save a figure as a DXF file:

from matplotlib import pyplot as plt
plt.plot(range(10))
plt.savefig('myplot.dxf')

Feature flags

mpldxf can optionally write each subplot into its own DXF block (nested under a single main_plot block) to keep modelspace clean and make downstream CAD reuse easier.

  • Default: disabled
  • Enable (legacy “write directly to modelspace” behavior): pass use_subplot_blocks=True via backend_dxf.make_figure_canvas(...).

Warning

This package is a work in progress. Not all Matplotlib plot types will render correctly, and text alignment and sizing in particular may require adjustments.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mpldxf-1.0.7.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mpldxf-1.0.7-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file mpldxf-1.0.7.tar.gz.

File metadata

  • Download URL: mpldxf-1.0.7.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mpldxf-1.0.7.tar.gz
Algorithm Hash digest
SHA256 2082f76ad6b18c2f2fe5e1d949f1c2f4cf243ebb832af76ea58306824c0e1ecd
MD5 936fbf4619fedc848a310a2a3252efae
BLAKE2b-256 fae81f6e3d5f206f2f79c745dbdf6fbbaea0ac6b1eb5a9fec75a1da8f11101dc

See more details on using hashes here.

File details

Details for the file mpldxf-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: mpldxf-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mpldxf-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 6b7a229a2b0cf6c57779e5e56de556486b7447b876e20c9fa5beeb1bd4ad29fa
MD5 788cbd82267305c6ee03bf198896e910
BLAKE2b-256 4d6aeb387b641bc9d4a2cba0785549ae7ca25b8305eec167b8b1bb398b07a54c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page