Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kwant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joseph Weston
kwant
Commits
67d979cc
Commit
67d979cc
authored
11 years ago
by
Anton Akhmerov
Committed by
Christoph Groth
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
change default 2D style, remove cruft from plotter
parent
3f54b221
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
doc/source/images/graphene.py.diff
+18
-15
18 additions, 15 deletions
doc/source/images/graphene.py.diff
doc/source/tutorial/graphene.py
+3
-2
3 additions, 2 deletions
doc/source/tutorial/graphene.py
kwant/plotter.py
+20
-23
20 additions, 23 deletions
kwant/plotter.py
with
41 additions
and
40 deletions
doc/source/images/graphene.py.diff
+
18
−
15
View file @
67d979cc
...
...
@@ -57,31 +57,34 @@
def main():
@@ -128,17 +147,22 @@
@@ -127,8 +146,11 @@
def family_colors(site):
return 0 if site.family == a else 1
# Plot the closed system without leads.
- kwant.plot(sys, site_color=family_colors, colorbar=False)
-
- # Compute some eigenvalues.
- compute_evs(sys.finalized())
- # Plot the closed system without leads.
- kwant.plot(sys, site_color=family_colors, site_lw=0.12, colorbar=False)
+ size = (_defs.figwidth_in, _defs.figwidth_in)
+ kwant.plot(sys, site_color=family_colors, colorbar=False,
+ kwant.plot(sys, site_color=family_colors,
site_lw=0.12,
colorbar=False,
+ file="graphene_sys1.pdf", fig_size=size, dpi=_defs.dpi)
+ kwant.plot(sys, site_color=family_colors, colorbar=False,
+ kwant.plot(sys, site_color=family_colors,
site_lw=0.12,
colorbar=False,
+ file="graphene_sys1.png", fig_size=size, dpi=_defs.dpi)
# Attach the leads to the system.
# Compute some eigenvalues.
compute_evs(sys.finalized())
@@ -137,9 +159,13 @@
for lead in leads:
sys.attach_lead(lead)
# Then, plot the system with leads.
- kwant.plot(sys, site_color=family_colors, colorbar=False)
- # Then, plot the system with leads.
- kwant.plot(sys, site_color=family_colors, site_lw=0.12,
- lead_site_lw=0, colorbar=False)
+ size = (_defs.figwidth_in, 0.9 * _defs.figwidth_in)
+ kwant.plot(sys, site_color=family_colors, colorbar=False,
+ file="graphene_sys2.pdf", fig_size=size, dpi=_defs.dpi)
+ kwant.plot(sys, site_color=family_colors, colorbar=False,
+ file="graphene_sys2.png", fig_size=size, dpi=_defs.dpi)
+ kwant.plot(sys, site_color=family_colors, colorbar=False, site_lw=0.12,
+ file="graphene_sys2.pdf", fig_size=size, dpi=_defs.dpi,
+ lead_site_lw=0)
+ kwant.plot(sys, site_color=family_colors, colorbar=False, site_lw=0.12,
+ file="graphene_sys2.png", fig_size=size, dpi=_defs.dpi,
+ lead_site_lw=0)
# Finalize the system.
sys = sys.finalized()
This diff is collapsed.
Click to expand it.
doc/source/tutorial/graphene.py
+
3
−
2
View file @
67d979cc
...
...
@@ -149,7 +149,7 @@ def main():
return
0
if
site
.
family
==
a
else
1
# Plot the closed system without leads.
kwant
.
plot
(
sys
,
site_color
=
family_colors
,
colorbar
=
False
)
kwant
.
plot
(
sys
,
site_color
=
family_colors
,
site_lw
=
0.12
,
colorbar
=
False
)
#HIDDEN_END_itkk
# Compute some eigenvalues.
...
...
@@ -162,7 +162,8 @@ def main():
sys
.
attach_lead
(
lead
)
# Then, plot the system with leads.
kwant
.
plot
(
sys
,
site_color
=
family_colors
,
colorbar
=
False
)
kwant
.
plot
(
sys
,
site_color
=
family_colors
,
site_lw
=
0.12
,
lead_site_lw
=
0
,
colorbar
=
False
)
# Finalize the system.
sys
=
sys
.
finalized
()
...
...
This diff is collapsed.
Click to expand it.
kwant/plotter.py
+
20
−
23
View file @
67d979cc
...
...
@@ -31,7 +31,6 @@ try:
from
matplotlib
import
collections
from
matplotlib.backends.backend_agg
import
FigureCanvasAgg
_mpl_enabled
=
True
from
matplotlib.cbook
import
is_string_like
,
is_sequence_of_strings
try
:
from
mpl_toolkits
import
mplot3d
has3d
=
True
...
...
@@ -59,9 +58,9 @@ def _isarray(var):
def
_nparray_if_array
(
var
):
return
np
.
asarray
(
var
)
if
_isarray
(
var
)
else
var
class
LineCollection
(
matplotlib
.
collections
.
LineCollection
):
class
LineCollection
(
collections
.
LineCollection
):
def
__init__
(
self
,
segments
,
reflen
=
None
,
**
kwargs
):
matplotlib
.
collections
.
LineCollection
.
__init__
(
self
,
segments
,
collections
.
LineCollection
.
__init__
(
self
,
segments
,
**
kwargs
)
self
.
reflen
=
reflen
...
...
@@ -76,19 +75,19 @@ class LineCollection(matplotlib.collections.LineCollection):
# 72.0 - there is 72 points in an inch
factor
=
(
self
.
axes
.
transData
.
frozen
().
to_values
()[
0
]
/
self
.
figure
.
dpi
*
72.0
*
self
.
reflen
)
matplotlib
.
collections
.
LineCollection
.
set_linewidths
(
self
,
collections
.
LineCollection
.
set_linewidths
(
self
,
self
.
_linewidths_orig
*
factor
)
else
:
matplotlib
.
collections
.
LineCollection
.
set_linewidths
(
self
,
collections
.
LineCollection
.
set_linewidths
(
self
,
self
.
_linewidths_orig
)
return
matplotlib
.
collections
.
LineCollection
.
draw
(
self
,
renderer
)
return
collections
.
LineCollection
.
draw
(
self
,
renderer
)
class
PathCollection
(
matplotlib
.
collections
.
PathCollection
):
class
PathCollection
(
collections
.
PathCollection
):
def
__init__
(
self
,
paths
,
sizes
=
None
,
reflen
=
None
,
**
kwargs
):
matplotlib
.
collections
.
PathCollection
.
__init__
(
self
,
paths
,
collections
.
PathCollection
.
__init__
(
self
,
paths
,
sizes
=
sizes
,
**
kwargs
)
...
...
@@ -120,7 +119,7 @@ class PathCollection(matplotlib.collections.PathCollection):
self
.
figure
.
dpi
*
72.0
*
self
.
reflen
)
self
.
set_linewidths
(
self
.
_linewidths_orig
*
factor
)
return
matplotlib
.
collections
.
Collection
.
draw
(
self
,
renderer
)
return
collections
.
Collection
.
draw
(
self
,
renderer
)
if
has3d
:
...
...
@@ -404,11 +403,9 @@ def set_colors(color, collection, cmap, norm=None):
collection
.
set_color
(
colors
)
symbol_dict
=
{
'
O
'
:
'
o
'
,
'
s
'
:
(
'
p
'
,
4
,
45
),
'
S
'
:
(
'
P
'
,
4
,
45
),
}
symbol_dict
=
{
'
O
'
:
'
o
'
,
'
s
'
:
(
'
p
'
,
4
,
45
),
'
S
'
:
(
'
P
'
,
4
,
45
)}
def
get_symbol
(
symbols
):
"""
Return the path corresponding to the description in `symbol`
...
...
@@ -991,15 +988,15 @@ def sys_leads_hopping_pos(sys, hop_lead_nr):
# Useful plot functions (to be extended).
_defaults
=
{
'
site_symbol
'
:
{
2
:
'
o
'
,
3
:
'
o
'
},
'
site_size
'
:
{
2
:
0.3
,
3
:
0.5
},
'
site_color
'
:
{
2
:
'
black
'
,
3
:
'
white
'
},
'
site_edgecolor
'
:
{
2
:
'
black
'
,
3
:
'
black
'
},
'
site_lw
'
:
{
2
:
0.12
,
3
:
0.12
},
'
hop_color
'
:
{
2
:
'
black
'
,
3
:
'
black
'
},
'
hop_lw
'
:
{
2
:
0.12
,
3
:
0
},
'
lead_color
'
:
{
2
:
'
red
'
,
3
:
'
red
'
}
}
_defaults
=
{
'
site_symbol
'
:
{
2
:
'
o
'
,
3
:
'
o
'
},
'
site_size
'
:
{
2
:
0.3
,
3
:
0.5
},
'
site_color
'
:
{
2
:
'
black
'
,
3
:
'
white
'
},
'
site_edgecolor
'
:
{
2
:
'
black
'
,
3
:
'
black
'
},
'
site_lw
'
:
{
2
:
0
,
3
:
0.12
},
'
hop_color
'
:
{
2
:
'
black
'
,
3
:
'
black
'
},
'
hop_lw
'
:
{
2
:
0.12
,
3
:
0
},
'
lead_color
'
:
{
2
:
'
red
'
,
3
:
'
red
'
}
}
def
plot
(
sys
,
num_lead_slices
=
2
,
units
=
'
nn
'
,
site_symbol
=
None
,
site_size
=
None
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment