help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Save Plot in Excel


From: Kwan Lowe
Subject: Re: Save Plot in Excel
Date: Fri, 3 Jul 2020 12:18:25 -0400

On Fri, Jul 3, 2020 at 11:37 AM Nicholas Jankowski <jankowskin@asme.org> wrote:

>> I have a question about output data of octave. I want to export plot images 
>> from octave to Microsoft Excel but I haven't found a function to help me.
>>
> So, there are functions that create Excel spreadsheets from Octave data.  Are 
> you asking if there is a way to
> create an Excel spreadsheet that contains an Excel plot of the data, and not 
> just an image of an Octave plot
> of the data?  I'm not sure Octave or Matlab have functions to do that. Plots 
> within Excel are notoriously
> cumbersome to work with. i'm sure there are some visual basic routines within 
> Excel that can script plot
> creation, but I'm unaware of any external functions to do that.
>
> Personally, having worked with large unwieldy spreadsheets with many repeated 
> plots, I think an octave driven
> function to script excel plot creation would be a godsend.  If anyone has 
> workable solutions, I'm all ears.

It doesn't look like the native Octave functions can write image data
directly, though they do seem to support writing
tables and other data.

Peeking into the XLSX created programmatically via Python, it doesn't
look horribly onerous but would not be trivial.

The XLSX is a zipfile containing the following structure:
.
├── [Content_Types].xml
├── docProps
│   ├── app.xml
│   └── core.xml
├── _rels
└── xl
    ├── drawings
    │   ├── drawing1.xml
    │   └── _rels
    │       └── drawing1.xml.rels
    ├── media
    │   └── image1.png
    ├── _rels
    │   └── workbook.xml.rels
    ├── styles.xml
    ├── theme
    │   └── theme1.xml
    ├── workbook.xml
    └── worksheets
        ├── _rels
        │   └── sheet1.xml.rels
        └── sheet1.xml


The file (xl/drawings/_rels/drawing1.xml.rels) contains the reference
to the PNG image file:

<Relationships 
xmlns="http://schemas.openxmlformats.org/package/2006/relationships";><Relationship
Id="rId1" 
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";
Target="../media/image1.png"/></Relationships>

It's all XML so would be possible to construct something with existing
Octave tooling.

There is an existing C++ XLSX library (OpenXLSX) so possibly an
oct-file approach may work if this is more cumbersome natively in
Octave.


-- 
"Don't be lazy. Do the thing. Do it properly."  - Simone Giertz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]