Skip to content

Commit

Permalink
fixed x and y axes in plot
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Simkovic committed Jan 30, 2017
1 parent 5c956fd commit 0a6af29
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions conkit/core/ContactMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,15 +644,18 @@ def plot_map(self, other=None, reference=None, altloc=False, file_format='png',
ax.set_ylabel(label)

# Allow dynamic x and y limits
min_res_seq = numpy.min(self_data.ravel()) - 5
max_res_seq = numpy.max(self_data.ravel()) + 5
min_res_seq = numpy.min(self_data.ravel())
max_res_seq = numpy.max(self_data.ravel())
if other:
min_res_seq = numpy.min(numpy.append(self_data.ravel(), other_data.ravel())) - 5
max_res_seq = numpy.max(numpy.append(self_data.ravel(), other_data.ravel())) + 5
ax.set_xlim(min_res_seq, max_res_seq)
ax.set_ylim(min_res_seq, max_res_seq)

# fig.tight_layout()
min_res_seq = numpy.min(numpy.append(self_data.ravel(), other_data.ravel()))
max_res_seq = numpy.max(numpy.append(self_data.ravel(), other_data.ravel()))
ax.set_xlim(min_res_seq - 0.5, max_res_seq + 0.5)
ax.set_ylim(min_res_seq - 0.5, max_res_seq + 0.5)

# Set the xticks and yticks dynamically
tick_range = numpy.arange(min_res_seq, max_res_seq, 10)
ax.set_xticks(tick_range)
ax.set_yticks(tick_range)

_, file_extension = file_name.rsplit('.', 1)
if file_extension != file_format:
Expand Down

0 comments on commit 0a6af29

Please sign in to comment.