Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 18th, 2012, 03:38 PM
jag_chandra jag_chandra is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 2 jag_chandra User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 51 sec
Reputation Power: 0
Drawing isosceles triangle using python Pyplot/Matplotlib

Hi all,
I'm trying to plot to isosceles triangle with two equals sides with * using pyplot or matplot lib module in python.
I couldn't find api to draw triangle and i'm not very familiar with the library. Does anyone know how to do it ?
Thanks in advance.

Reply With Quote
  #2  
Old November 19th, 2012, 10:21 AM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,384 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 13 h 48 m 49 sec
Reputation Power: 383
Why do you need matplotlib or pyplot? Why does your isosceles triangle need two equals sides?
Code:
try:
    import Tkinter as tkinter
except:
    import tkinter    

import time

iso = ((10,10,40,50,70,10,),(180,50,120,180,60,50,),)
canvas = tkinter.Canvas(width=400,height=200)
canvas.pack()
polygon = canvas.create_polygon(*(iso[0]))
colors = 'red green blue yellow orange'.split()
for i in range(9):
    canvas.coords(polygon,*(iso[i&1]))
    canvas.itemconfig(polygon,fill=colors[i%len(colors)])
    canvas.update()
    time.sleep(1)
__________________
[code]Code tags[/code] are essential for python code!

Reply With Quote
  #3  
Old November 19th, 2012, 11:09 AM
jag_chandra jag_chandra is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 2 jag_chandra User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 51 sec
Reputation Power: 0
Thanks for the reply
It can be either matplotlib or pyplot but it has to be one of them as i've requirement to use one of them .

Why does your isosceles triangle need two equals sides?
Isosceles triangles have two equal sides

Isn't tkinter different library altogether or is it part of matplotlib ?

Quote:
Originally Posted by b49P23TIvg

Code:
try:
    import Tkinter as tkinter
except:
    import tkinter    

import time

iso = ((10,10,40,50,70,10,),(180,50,120,180,60,50,),)
canvas = tkinter.Canvas(width=400,height=200)
canvas.pack()
polygon = canvas.create_polygon(*(iso[0]))
colors = 'red green blue yellow orange'.split()
for i in range(9):
    canvas.coords(polygon,*(iso[i&1]))
    canvas.itemconfig(polygon,fill=colors[i%len(colors)])
    canvas.update()
    time.sleep(1)

Reply With Quote
  #4  
Old November 19th, 2012, 11:30 AM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,384 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 13 h 48 m 49 sec
Reputation Power: 383
http://exnumerus.blogspot.com/2011/02/how-to-quickly-plot-polygons-in.html


you wrote the redundant sentence

And what do you mean by "with *"?

Yes, tkinter uses tcl. matplotlib seems to use gtk.

Reply With Quote
  #5  
Old November 19th, 2012, 12:31 PM
Dietrich's Avatar
Dietrich Dietrich is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 483 Dietrich User rank is Second Lieutenant (5000 - 10000 Reputation Level)Dietrich User rank is Second Lieutenant (5000 - 10000 Reputation Level)Dietrich User rank is Second Lieutenant (5000 - 10000 Reputation Level)Dietrich User rank is Second Lieutenant (5000 - 10000 Reputation Level)Dietrich User rank is Second Lieutenant (5000 - 10000 Reputation Level)Dietrich User rank is Second Lieutenant (5000 - 10000 Reputation Level)Dietrich User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 22 h 51 m 26 sec
Reputation Power: 63
Experiment with something like that:
Code:
import matplotlib.pyplot as plt

plt.plot([1,2,3])

plt.plot([3,2,1])

plt.plot([2,2,2])

plt.show()
__________________
Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Drawing isosceles triangle using python Pyplot/Matplotlib

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap