我试图绘制可以组装成一个2x2矩阵的4个矩阵。无论出于何种原因,最后一个矩阵D太大了。我希望它的大小与其轴成比例。我正在使用Python 3.6。
2018-03-10 03:29:32:308 INFO {db=db} ok size=1024b compressedSize=15 ratio=99% elapsed=0msException `2A65CB6D` in storage `plocal:/home/dmsadmin/dms2/env/duri_prod/db`: 2.2.33 (build 77584cd6827f647cf4aa231cf27bd6f10bc04e2c, branch 2.2.x)
java.lang.IllegalArgumentException: Directory /home/dmsadmin/dms2/env/duri_prod/db/db.1045.wal not found
at com.orientechnologies.orient.core.compression.impl.OZIPCompressionUtil.addFolder(OZIPCompressionUtil.java:145)
at com.orientechnologies.orient.core.compression.impl.OZIPCompressionUtil.addFolder(OZIPCompressionUtil.java:127)
at com.orientechnologies.orient.core.compression.impl.OZIPCompressionUtil.compressDirectory(OZIPCompressionUtil.java:57)
at com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage.backup(OLocalPaginatedStorage.java:229)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.backup(ODatabaseDocumentTx.java:3061)
at com.orientechnologies.orient.server.handler.OAutomaticBackup.fullBackupDatabase(OAutomaticBackup.java:353)
at com.orientechnologies.orient.server.handler.OAutomaticBackup$1.run(OAutomaticBackup.java:183)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
$ANSI{green {db=db}} Error on backup of database 'plocal:/home/dmsadmin/dms2/env/duri_prod/db' to directory: /backup/dms2/
java.lang.IllegalArgumentException: Directory /home/dmsadmin/dms2/env/duri_prod/db/db.1045.wal not found
at com.orientechnologies.orient.core.compression.impl.OZIPCompressionUtil.addFolder(OZIPCompressionUtil.java:145)
at com.orientechnologies.orient.core.compression.impl.OZIPCompressionUtil.addFolder(OZIPCompressionUtil.java:127)
at com.orientechnologies.orient.core.compression.impl.OZIPCompressionUtil.compressDirectory(OZIPCompressionUtil.java:57)
at com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage.backup(OLocalPaginatedStorage.java:229)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.backup(ODatabaseDocumentTx.java:3061)
at com.orientechnologies.orient.server.handler.OAutomaticBackup.fullBackupDatabase(OAutomaticBackup.java:353)
at com.orientechnologies.orient.server.handler.OAutomaticBackup$1.run(OAutomaticBackup.java:183)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
2018-03-10 03:29:32:313 INFO Automatic Backup finished: 0 ok, 1 errors
答案 0 :(得分:2)
在问题的代码中,子图列和行的宽度和高度分别相等。你想要的是使第一列和第一行比第二列大4倍。
这可以使用gridspec的height_ratios
和width_ratios
轻松完成。
import matplotlib.pyplot as plt
import numpy as np
A = np.random.rand(500,500)
fig, axs = plt.subplots(nrows=2, ncols=2, figsize=(7, 7),
gridspec_kw=dict(height_ratios=[4,1], width_ratios=[4,1]))
axs[0, 0].set_title('A')
axs[0, 0].imshow(A[:400,:400], vmin=0, vmax=1)
axs[0, 1].set_title('B')
axs[0, 1].imshow(A[:400,400:], vmin=0, vmax=1)
axs[1, 0].set_title('C')
axs[1, 0].imshow(A[400:,:400], vmin=0, vmax=1)
axs[1, 1].set_title('D')
axs[1, 1].imshow(A[400:,400:], vmin=0, vmax=1)
plt.show()