Hello,
You have to draw lines between your points.
A solution is to use polyhedron. For instance :
hexa0 = polytopes.regular_polygon(6)
hexa1 = hexa0.translation([float(sqrt(3))/2,1.5])
g = Graphics()
i = 0
while i < 6:
j = 0
while j < 4:
hexa00 = hexa0.translation([i*float(sqrt(3)),j*(3)])
outline00 = hexa00.projection().render_outline_2d()
hexa11 = hexa1.translation([i*float(sqrt(3)),j*(3)])
outline11 = hexa11.projection().render_outline_2d()
g += outline00 + outline11
j += 1
i += 1
g.show(aspect_ratio=1)
Le samedi 18 mai 2019 20:44:15 UTC+2, Grumby a écrit :
>
>
>
> Le vendredi 17 mai 2019 05:35:54 UTC+2, saad khalid a écrit :
>>
>> Hi everyone:
>>
>> I'm trying to using Sage's plot functionality to plot the honeycomb
>> lattice:
>>
>> https://sites.google.com/site/makingplots4scipurposes/_/rsrc/1456789513003/gnuplot-samples-of-2d-lattices/honeycomb.png
>>
>> Plotting the honeycomb lattice is slightly different from plotting a
>> simple (like a square) lattice, as each site is technically two points,
>> with a basis vector pointing from one point to the other within a single
>> site. So you take your two lattice vectors and start from some point and
>> generate all possible points from those lattice vectors. Then you go back
>> to your starting point, shift by the basis vector, and then generate all
>> possible points from there using the lattice vector, and then you add these
>> two sets of points together to get the honeycomb lattice. I've figured out
>> how to do it using points at the corner of each hexagon, like this:
>> list_plot(flatten([[a*vector([sqrt(3)/2,1/2]) + b*vector([sqrt(3)/2,-1/2
>> ]) for a in (0..30)] for b in (0..30)] + [[a*vector([sqrt(3)/2,1/2]) + b*
>> vector([sqrt(3)/2,-1/2]) + vector([-1/sqrt(2),0]) for a in (0..30)] for
>> b in (0..30)]))
>>
>> However, I was hoping to do this with lines outlining the hexagons as
>> shown in the linked image. Would anyone know of a way to do this? Thanks!
>>
>
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sage-support/e7f5aa74-ecc6-40e2-819f-d77727d25eec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.