Donut Plots

Posted on
Fri Feb 02, 2018 7:23 pm
DaveL17 offline
User avatar
Posts: 4308
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Donut Plots

Another possibility -- this one was designed for a dimmer.

figure_on.png
figure_on.png (11.2 KiB) Viewed 349 times
figure_off.png
figure_off.png (11.44 KiB) Viewed 349 times


Any interest?

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Fri Feb 02, 2018 8:31 pm
RogueProeliator offline
User avatar
Posts: 2094
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Donut Plots

Frick, I was excited at the title - thought it was plotting the fastest route to the donut shop... now THAT would have some W.A.F.! I do like that idea for use on a dimmer - does it look okay at smaller resolutions (like 48x48) or would it need to be a larger graphic?

Adam

Posted on
Fri Feb 02, 2018 9:01 pm
DaveL17 offline
User avatar
Posts: 4308
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Donut Plots

Heh, now *that* would be a plugin to have. Here's one that's something like 60x60 (the plot, not the canvas).

figure_on.png
figure_on.png (3.22 KiB) Viewed 328 times


Here's a fancier version of the larger size (that's still rough).

figure_on1.png
figure_on1.png (12.9 KiB) Viewed 328 times

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sat Feb 03, 2018 9:41 am
DaveL17 offline
User avatar
Posts: 4308
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Donut Plots

The rendering of graphics in PNG seems to be worse the smaller you go. This one's about 100x100.

_figure_on1.png
_figure_on1.png (4 KiB) Viewed 279 times

Added to a control page with text:

Screen Shot 2018-02-03 at 9.34.00 AM.png
Screen Shot 2018-02-03 at 9.34.00 AM.png (11.21 KiB) Viewed 279 times

They look much better when rendered as vector images.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sat Feb 03, 2018 10:32 am
Colorado4Wheeler offline
User avatar
Posts: 2747
Joined: Jul 20, 2009
Location: Colorado

Re: Donut Plots

I really like the idea of this. I haven't dove into Matplotlib yet but for control pages I've tried to think of a way to have the circular "brightness indication" as an image behind a round button. So in your example the button would be transparent where your blue is (to as much or as little of a slice as desired). I actually was writing a control page package last year but gave up on it because I was using all round buttons and it felt only half there, but with this I could make those round buttons far more useful. This isn't to say that I'm going to revisit that idea or that I need this Donut Plot, but that's one really cool use for it.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Sat Feb 03, 2018 10:46 am
DaveL17 offline
User avatar
Posts: 4308
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Donut Plots

Can't take credit for the idea; others have posted similar implementations--just putting my spin on it to see if it would be a useful matplotlib plugin device type (there would be others in the same family). Here is the bare-bones script that I used to generate the image. It's from a scratchpad and not the plugin.

Code: Select all
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import matplotlib.pyplot as plt
import matplotlib.patches as patches

fig = plt.figure(1, figsize=(.5,.5), dpi=200)
ax = fig.add_subplot(111, axisbg='#FFFFFF')

level = 60
on = True
k_dict = {'bbox_extra_artists': None, 'bbox_inches': None, 'format': None, 'frameon': None, 'orientation': None, 'pad_inches': None,
          'papertype': None, 'transparent': True}
         
if on:
    colors = ['#000000','#0000FF']
else:
    colors = ['#000000','#333333']

wedges, texts = ax.pie([100-level, level], colors=colors, startangle=90)

wedges[1].set_edgecolor('#000000')

inner_circle = plt.Circle((0,0), .65, facecolor="#000000", edgecolor='#777777', lw=.25)
ax.add_artist(inner_circle)

outer_circle = plt.Circle((0,0), 1, facecolor=None, edgecolor='#777777', fill=False, alpha=1, lw=.25)
ax.add_artist(outer_circle)

plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)

plt.savefig('/Users/USERNAME/Desktop/figure_on1.png', dpi=200, **k_dict)


I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest