scientific-writer 2.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scientific_writer/.claude/WRITER.md +822 -0
- scientific_writer/.claude/settings.local.json +30 -0
- scientific_writer/.claude/skills/citation-management/SKILL.md +1046 -0
- scientific_writer/.claude/skills/citation-management/assets/bibtex_template.bib +264 -0
- scientific_writer/.claude/skills/citation-management/assets/citation_checklist.md +386 -0
- scientific_writer/.claude/skills/citation-management/references/bibtex_formatting.md +908 -0
- scientific_writer/.claude/skills/citation-management/references/citation_validation.md +794 -0
- scientific_writer/.claude/skills/citation-management/references/google_scholar_search.md +725 -0
- scientific_writer/.claude/skills/citation-management/references/metadata_extraction.md +870 -0
- scientific_writer/.claude/skills/citation-management/references/pubmed_search.md +839 -0
- scientific_writer/.claude/skills/citation-management/scripts/doi_to_bibtex.py +204 -0
- scientific_writer/.claude/skills/citation-management/scripts/extract_metadata.py +569 -0
- scientific_writer/.claude/skills/citation-management/scripts/format_bibtex.py +349 -0
- scientific_writer/.claude/skills/citation-management/scripts/search_google_scholar.py +282 -0
- scientific_writer/.claude/skills/citation-management/scripts/search_pubmed.py +398 -0
- scientific_writer/.claude/skills/citation-management/scripts/validate_citations.py +497 -0
- scientific_writer/.claude/skills/clinical-reports/IMPLEMENTATION_SUMMARY.md +641 -0
- scientific_writer/.claude/skills/clinical-reports/README.md +236 -0
- scientific_writer/.claude/skills/clinical-reports/SKILL.md +1088 -0
- scientific_writer/.claude/skills/clinical-reports/assets/case_report_template.md +352 -0
- scientific_writer/.claude/skills/clinical-reports/assets/clinical_trial_csr_template.md +353 -0
- scientific_writer/.claude/skills/clinical-reports/assets/clinical_trial_sae_template.md +359 -0
- scientific_writer/.claude/skills/clinical-reports/assets/consult_note_template.md +305 -0
- scientific_writer/.claude/skills/clinical-reports/assets/discharge_summary_template.md +453 -0
- scientific_writer/.claude/skills/clinical-reports/assets/hipaa_compliance_checklist.md +395 -0
- scientific_writer/.claude/skills/clinical-reports/assets/history_physical_template.md +305 -0
- scientific_writer/.claude/skills/clinical-reports/assets/lab_report_template.md +309 -0
- scientific_writer/.claude/skills/clinical-reports/assets/pathology_report_template.md +249 -0
- scientific_writer/.claude/skills/clinical-reports/assets/quality_checklist.md +338 -0
- scientific_writer/.claude/skills/clinical-reports/assets/radiology_report_template.md +318 -0
- scientific_writer/.claude/skills/clinical-reports/assets/soap_note_template.md +253 -0
- scientific_writer/.claude/skills/clinical-reports/references/case_report_guidelines.md +570 -0
- scientific_writer/.claude/skills/clinical-reports/references/clinical_trial_reporting.md +693 -0
- scientific_writer/.claude/skills/clinical-reports/references/data_presentation.md +530 -0
- scientific_writer/.claude/skills/clinical-reports/references/diagnostic_reports_standards.md +629 -0
- scientific_writer/.claude/skills/clinical-reports/references/medical_terminology.md +588 -0
- scientific_writer/.claude/skills/clinical-reports/references/patient_documentation.md +744 -0
- scientific_writer/.claude/skills/clinical-reports/references/peer_review_standards.md +585 -0
- scientific_writer/.claude/skills/clinical-reports/references/regulatory_compliance.md +577 -0
- scientific_writer/.claude/skills/clinical-reports/scripts/check_deidentification.py +346 -0
- scientific_writer/.claude/skills/clinical-reports/scripts/compliance_checker.py +78 -0
- scientific_writer/.claude/skills/clinical-reports/scripts/extract_clinical_data.py +102 -0
- scientific_writer/.claude/skills/clinical-reports/scripts/format_adverse_events.py +103 -0
- scientific_writer/.claude/skills/clinical-reports/scripts/generate_report_template.py +163 -0
- scientific_writer/.claude/skills/clinical-reports/scripts/terminology_validator.py +133 -0
- scientific_writer/.claude/skills/clinical-reports/scripts/validate_case_report.py +334 -0
- scientific_writer/.claude/skills/clinical-reports/scripts/validate_trial_report.py +89 -0
- scientific_writer/.claude/skills/document-skills/docx/LICENSE.txt +30 -0
- scientific_writer/.claude/skills/document-skills/docx/SKILL.md +197 -0
- scientific_writer/.claude/skills/document-skills/docx/docx-js.md +350 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/mce/mc.xsd +75 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/scripts/pack.py +159 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/scripts/unpack.py +29 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/scripts/validate.py +69 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/scripts/validation/__init__.py +15 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/scripts/validation/base.py +951 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/scripts/validation/docx.py +274 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/scripts/validation/pptx.py +315 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml/scripts/validation/redlining.py +279 -0
- scientific_writer/.claude/skills/document-skills/docx/ooxml.md +610 -0
- scientific_writer/.claude/skills/document-skills/docx/scripts/__init__.py +1 -0
- scientific_writer/.claude/skills/document-skills/docx/scripts/document.py +1276 -0
- scientific_writer/.claude/skills/document-skills/docx/scripts/templates/comments.xml +3 -0
- scientific_writer/.claude/skills/document-skills/docx/scripts/templates/commentsExtended.xml +3 -0
- scientific_writer/.claude/skills/document-skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- scientific_writer/.claude/skills/document-skills/docx/scripts/templates/commentsIds.xml +3 -0
- scientific_writer/.claude/skills/document-skills/docx/scripts/templates/people.xml +3 -0
- scientific_writer/.claude/skills/document-skills/docx/scripts/utilities.py +374 -0
- scientific_writer/.claude/skills/document-skills/pdf/LICENSE.txt +30 -0
- scientific_writer/.claude/skills/document-skills/pdf/SKILL.md +294 -0
- scientific_writer/.claude/skills/document-skills/pdf/forms.md +205 -0
- scientific_writer/.claude/skills/document-skills/pdf/reference.md +612 -0
- scientific_writer/.claude/skills/document-skills/pdf/scripts/check_bounding_boxes.py +70 -0
- scientific_writer/.claude/skills/document-skills/pdf/scripts/check_bounding_boxes_test.py +226 -0
- scientific_writer/.claude/skills/document-skills/pdf/scripts/check_fillable_fields.py +12 -0
- scientific_writer/.claude/skills/document-skills/pdf/scripts/convert_pdf_to_images.py +35 -0
- scientific_writer/.claude/skills/document-skills/pdf/scripts/create_validation_image.py +41 -0
- scientific_writer/.claude/skills/document-skills/pdf/scripts/extract_form_field_info.py +152 -0
- scientific_writer/.claude/skills/document-skills/pdf/scripts/fill_fillable_fields.py +114 -0
- scientific_writer/.claude/skills/document-skills/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
- scientific_writer/.claude/skills/document-skills/pptx/LICENSE.txt +30 -0
- scientific_writer/.claude/skills/document-skills/pptx/SKILL.md +484 -0
- scientific_writer/.claude/skills/document-skills/pptx/html2pptx.md +625 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/mce/mc.xsd +75 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/scripts/pack.py +159 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/scripts/unpack.py +29 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/scripts/validate.py +69 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/scripts/validation/__init__.py +15 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/scripts/validation/base.py +951 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/scripts/validation/docx.py +274 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/scripts/validation/pptx.py +315 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml/scripts/validation/redlining.py +279 -0
- scientific_writer/.claude/skills/document-skills/pptx/ooxml.md +427 -0
- scientific_writer/.claude/skills/document-skills/pptx/scripts/html2pptx.js +979 -0
- scientific_writer/.claude/skills/document-skills/pptx/scripts/inventory.py +1020 -0
- scientific_writer/.claude/skills/document-skills/pptx/scripts/rearrange.py +231 -0
- scientific_writer/.claude/skills/document-skills/pptx/scripts/replace.py +385 -0
- scientific_writer/.claude/skills/document-skills/pptx/scripts/thumbnail.py +450 -0
- scientific_writer/.claude/skills/document-skills/xlsx/LICENSE.txt +30 -0
- scientific_writer/.claude/skills/document-skills/xlsx/SKILL.md +289 -0
- scientific_writer/.claude/skills/document-skills/xlsx/recalc.py +178 -0
- scientific_writer/.claude/skills/hypothesis-generation/SKILL.md +155 -0
- scientific_writer/.claude/skills/hypothesis-generation/assets/hypothesis_output_template.md +302 -0
- scientific_writer/.claude/skills/hypothesis-generation/references/experimental_design_patterns.md +327 -0
- scientific_writer/.claude/skills/hypothesis-generation/references/hypothesis_quality_criteria.md +196 -0
- scientific_writer/.claude/skills/hypothesis-generation/references/literature_search_strategies.md +505 -0
- scientific_writer/.claude/skills/latex-posters/README.md +417 -0
- scientific_writer/.claude/skills/latex-posters/SKILL.md +919 -0
- scientific_writer/.claude/skills/latex-posters/assets/baposter_template.tex +257 -0
- scientific_writer/.claude/skills/latex-posters/assets/beamerposter_template.tex +244 -0
- scientific_writer/.claude/skills/latex-posters/assets/poster_quality_checklist.md +358 -0
- scientific_writer/.claude/skills/latex-posters/assets/tikzposter_template.tex +251 -0
- scientific_writer/.claude/skills/latex-posters/references/latex_poster_packages.md +745 -0
- scientific_writer/.claude/skills/latex-posters/references/poster_content_guide.md +748 -0
- scientific_writer/.claude/skills/latex-posters/references/poster_design_principles.md +806 -0
- scientific_writer/.claude/skills/latex-posters/references/poster_layout_design.md +900 -0
- scientific_writer/.claude/skills/latex-posters/scripts/review_poster.sh +214 -0
- scientific_writer/.claude/skills/literature-review/SKILL.md +546 -0
- scientific_writer/.claude/skills/literature-review/assets/review_template.md +412 -0
- scientific_writer/.claude/skills/literature-review/references/citation_styles.md +166 -0
- scientific_writer/.claude/skills/literature-review/references/database_strategies.md +381 -0
- scientific_writer/.claude/skills/literature-review/scripts/generate_pdf.py +176 -0
- scientific_writer/.claude/skills/literature-review/scripts/search_databases.py +303 -0
- scientific_writer/.claude/skills/literature-review/scripts/verify_citations.py +222 -0
- scientific_writer/.claude/skills/markitdown/INSTALLATION_GUIDE.md +318 -0
- scientific_writer/.claude/skills/markitdown/LICENSE.txt +22 -0
- scientific_writer/.claude/skills/markitdown/OPENROUTER_INTEGRATION.md +359 -0
- scientific_writer/.claude/skills/markitdown/QUICK_REFERENCE.md +309 -0
- scientific_writer/.claude/skills/markitdown/README.md +184 -0
- scientific_writer/.claude/skills/markitdown/SKILL.md +450 -0
- scientific_writer/.claude/skills/markitdown/SKILL_SUMMARY.md +307 -0
- scientific_writer/.claude/skills/markitdown/assets/example_usage.md +463 -0
- scientific_writer/.claude/skills/markitdown/references/api_reference.md +399 -0
- scientific_writer/.claude/skills/markitdown/references/file_formats.md +542 -0
- scientific_writer/.claude/skills/markitdown/scripts/batch_convert.py +228 -0
- scientific_writer/.claude/skills/markitdown/scripts/convert_literature.py +283 -0
- scientific_writer/.claude/skills/markitdown/scripts/convert_with_ai.py +243 -0
- scientific_writer/.claude/skills/paper-2-web/SKILL.md +455 -0
- scientific_writer/.claude/skills/paper-2-web/references/installation.md +141 -0
- scientific_writer/.claude/skills/paper-2-web/references/paper2poster.md +346 -0
- scientific_writer/.claude/skills/paper-2-web/references/paper2video.md +305 -0
- scientific_writer/.claude/skills/paper-2-web/references/paper2web.md +187 -0
- scientific_writer/.claude/skills/paper-2-web/references/usage_examples.md +436 -0
- scientific_writer/.claude/skills/peer-review/SKILL.md +375 -0
- scientific_writer/.claude/skills/peer-review/references/common_issues.md +552 -0
- scientific_writer/.claude/skills/peer-review/references/reporting_standards.md +290 -0
- scientific_writer/.claude/skills/research-grants/README.md +285 -0
- scientific_writer/.claude/skills/research-grants/SKILL.md +896 -0
- scientific_writer/.claude/skills/research-grants/assets/budget_justification_template.md +453 -0
- scientific_writer/.claude/skills/research-grants/assets/nih_specific_aims_template.md +166 -0
- scientific_writer/.claude/skills/research-grants/assets/nsf_project_summary_template.md +92 -0
- scientific_writer/.claude/skills/research-grants/references/broader_impacts.md +392 -0
- scientific_writer/.claude/skills/research-grants/references/darpa_guidelines.md +636 -0
- scientific_writer/.claude/skills/research-grants/references/doe_guidelines.md +586 -0
- scientific_writer/.claude/skills/research-grants/references/nih_guidelines.md +851 -0
- scientific_writer/.claude/skills/research-grants/references/nsf_guidelines.md +570 -0
- scientific_writer/.claude/skills/research-grants/references/specific_aims_guide.md +458 -0
- scientific_writer/.claude/skills/research-lookup/README.md +116 -0
- scientific_writer/.claude/skills/research-lookup/SKILL.md +443 -0
- scientific_writer/.claude/skills/research-lookup/examples.py +174 -0
- scientific_writer/.claude/skills/research-lookup/lookup.py +93 -0
- scientific_writer/.claude/skills/research-lookup/research_lookup.py +335 -0
- scientific_writer/.claude/skills/research-lookup/scripts/research_lookup.py +261 -0
- scientific_writer/.claude/skills/scholar-evaluation/SKILL.md +254 -0
- scientific_writer/.claude/skills/scholar-evaluation/references/evaluation_framework.md +663 -0
- scientific_writer/.claude/skills/scholar-evaluation/scripts/calculate_scores.py +378 -0
- scientific_writer/.claude/skills/scientific-critical-thinking/SKILL.md +530 -0
- scientific_writer/.claude/skills/scientific-critical-thinking/references/common_biases.md +364 -0
- scientific_writer/.claude/skills/scientific-critical-thinking/references/evidence_hierarchy.md +484 -0
- scientific_writer/.claude/skills/scientific-critical-thinking/references/experimental_design.md +496 -0
- scientific_writer/.claude/skills/scientific-critical-thinking/references/logical_fallacies.md +478 -0
- scientific_writer/.claude/skills/scientific-critical-thinking/references/scientific_method.md +169 -0
- scientific_writer/.claude/skills/scientific-critical-thinking/references/statistical_pitfalls.md +506 -0
- scientific_writer/.claude/skills/scientific-schematics/SKILL.md +2035 -0
- scientific_writer/.claude/skills/scientific-schematics/assets/block_diagram_template.tex +199 -0
- scientific_writer/.claude/skills/scientific-schematics/assets/circuit_template.tex +159 -0
- scientific_writer/.claude/skills/scientific-schematics/assets/flowchart_template.tex +161 -0
- scientific_writer/.claude/skills/scientific-schematics/assets/pathway_template.tex +162 -0
- scientific_writer/.claude/skills/scientific-schematics/assets/tikz_styles.tex +422 -0
- scientific_writer/.claude/skills/scientific-schematics/references/best_practices.md +562 -0
- scientific_writer/.claude/skills/scientific-schematics/references/diagram_types.md +637 -0
- scientific_writer/.claude/skills/scientific-schematics/references/python_libraries.md +791 -0
- scientific_writer/.claude/skills/scientific-schematics/references/tikz_guide.md +734 -0
- scientific_writer/.claude/skills/scientific-schematics/scripts/circuit_generator.py +307 -0
- scientific_writer/.claude/skills/scientific-schematics/scripts/compile_tikz.py +292 -0
- scientific_writer/.claude/skills/scientific-schematics/scripts/generate_flowchart.py +281 -0
- scientific_writer/.claude/skills/scientific-schematics/scripts/pathway_diagram.py +406 -0
- scientific_writer/.claude/skills/scientific-writing/SKILL.md +443 -0
- scientific_writer/.claude/skills/scientific-writing/references/citation_styles.md +720 -0
- scientific_writer/.claude/skills/scientific-writing/references/figures_tables.md +806 -0
- scientific_writer/.claude/skills/scientific-writing/references/imrad_structure.md +658 -0
- scientific_writer/.claude/skills/scientific-writing/references/reporting_guidelines.md +748 -0
- scientific_writer/.claude/skills/scientific-writing/references/writing_principles.md +824 -0
- scientific_writer/.claude/skills/treatment-plans/README.md +488 -0
- scientific_writer/.claude/skills/treatment-plans/SKILL.md +1536 -0
- scientific_writer/.claude/skills/treatment-plans/assets/STYLING_QUICK_REFERENCE.md +185 -0
- scientific_writer/.claude/skills/treatment-plans/assets/chronic_disease_management_plan.tex +665 -0
- scientific_writer/.claude/skills/treatment-plans/assets/general_medical_treatment_plan.tex +547 -0
- scientific_writer/.claude/skills/treatment-plans/assets/medical_treatment_plan.sty +222 -0
- scientific_writer/.claude/skills/treatment-plans/assets/mental_health_treatment_plan.tex +774 -0
- scientific_writer/.claude/skills/treatment-plans/assets/one_page_treatment_plan.tex +193 -0
- scientific_writer/.claude/skills/treatment-plans/assets/pain_management_plan.tex +799 -0
- scientific_writer/.claude/skills/treatment-plans/assets/perioperative_care_plan.tex +753 -0
- scientific_writer/.claude/skills/treatment-plans/assets/quality_checklist.md +471 -0
- scientific_writer/.claude/skills/treatment-plans/assets/rehabilitation_treatment_plan.tex +756 -0
- scientific_writer/.claude/skills/treatment-plans/references/goal_setting_frameworks.md +411 -0
- scientific_writer/.claude/skills/treatment-plans/references/intervention_guidelines.md +507 -0
- scientific_writer/.claude/skills/treatment-plans/references/regulatory_compliance.md +476 -0
- scientific_writer/.claude/skills/treatment-plans/references/specialty_specific_guidelines.md +655 -0
- scientific_writer/.claude/skills/treatment-plans/references/treatment_plan_standards.md +485 -0
- scientific_writer/.claude/skills/treatment-plans/scripts/check_completeness.py +318 -0
- scientific_writer/.claude/skills/treatment-plans/scripts/generate_template.py +244 -0
- scientific_writer/.claude/skills/treatment-plans/scripts/timeline_generator.py +369 -0
- scientific_writer/.claude/skills/treatment-plans/scripts/validate_treatment_plan.py +367 -0
- scientific_writer/.claude/skills/venue-templates/SKILL.md +590 -0
- scientific_writer/.claude/skills/venue-templates/assets/grants/nih_specific_aims.tex +235 -0
- scientific_writer/.claude/skills/venue-templates/assets/grants/nsf_proposal_template.tex +375 -0
- scientific_writer/.claude/skills/venue-templates/assets/journals/nature_article.tex +171 -0
- scientific_writer/.claude/skills/venue-templates/assets/journals/neurips_article.tex +283 -0
- scientific_writer/.claude/skills/venue-templates/assets/journals/plos_one.tex +317 -0
- scientific_writer/.claude/skills/venue-templates/assets/posters/beamerposter_academic.tex +311 -0
- scientific_writer/.claude/skills/venue-templates/references/conferences_formatting.md +564 -0
- scientific_writer/.claude/skills/venue-templates/references/grants_requirements.md +787 -0
- scientific_writer/.claude/skills/venue-templates/references/journals_formatting.md +486 -0
- scientific_writer/.claude/skills/venue-templates/references/posters_guidelines.md +628 -0
- scientific_writer/.claude/skills/venue-templates/scripts/customize_template.py +206 -0
- scientific_writer/.claude/skills/venue-templates/scripts/query_template.py +260 -0
- scientific_writer/.claude/skills/venue-templates/scripts/validate_format.py +255 -0
- scientific_writer/__init__.py +43 -0
- scientific_writer/api.py +393 -0
- scientific_writer/cli.py +326 -0
- scientific_writer/core.py +275 -0
- scientific_writer/models.py +76 -0
- scientific_writer/utils.py +289 -0
- scientific_writer-2.3.1.dist-info/METADATA +272 -0
- scientific_writer-2.3.1.dist-info/RECORD +315 -0
- scientific_writer-2.3.1.dist-info/WHEEL +4 -0
- scientific_writer-2.3.1.dist-info/entry_points.txt +2 -0
- scientific_writer-2.3.1.dist-info/licenses/LICENSE +22 -0
|
@@ -0,0 +1,791 @@
|
|
|
1
|
+
# Python Libraries for Scientific Diagram Generation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This guide covers Python libraries for programmatic generation of scientific diagrams: Schemdraw for circuit diagrams, NetworkX for network diagrams, and Matplotlib for custom diagrams. These tools enable data-driven diagram creation, batch generation, and integration with scientific workflows.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Install all diagram-related packages
|
|
11
|
+
pip install schemdraw networkx matplotlib numpy
|
|
12
|
+
|
|
13
|
+
# Optional for enhanced features
|
|
14
|
+
pip install pygraphviz # Better NetworkX layouts (requires Graphviz)
|
|
15
|
+
pip install pillow # Image export options
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Schemdraw: Circuit and Electrical Diagrams
|
|
19
|
+
|
|
20
|
+
### Overview
|
|
21
|
+
|
|
22
|
+
Schemdraw creates publication-quality electrical schematics with an intuitive Python API. Perfect for electronics papers, instrumentation descriptions, and signal processing diagrams.
|
|
23
|
+
|
|
24
|
+
**Official Documentation**: https://schemdraw.readthedocs.io/
|
|
25
|
+
|
|
26
|
+
### Basic Usage
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
import schemdraw
|
|
30
|
+
import schemdraw.elements as elm
|
|
31
|
+
|
|
32
|
+
# Create drawing
|
|
33
|
+
d = schemdraw.Drawing()
|
|
34
|
+
|
|
35
|
+
# Add components
|
|
36
|
+
d += elm.SourceV().label('5V')
|
|
37
|
+
d += elm.Resistor().right().label('1kΩ')
|
|
38
|
+
d += elm.Capacitor().down().label('10µF')
|
|
39
|
+
d += elm.Line().left()
|
|
40
|
+
d += elm.Ground()
|
|
41
|
+
|
|
42
|
+
# Display or save
|
|
43
|
+
d.save('circuit.pdf')
|
|
44
|
+
d.save('circuit.svg')
|
|
45
|
+
d.save('circuit.png', dpi=300)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Core Concepts
|
|
49
|
+
|
|
50
|
+
**Element Addition**
|
|
51
|
+
```python
|
|
52
|
+
# Add elements with +=
|
|
53
|
+
d += elm.Resistor()
|
|
54
|
+
|
|
55
|
+
# Chain methods for placement
|
|
56
|
+
d += elm.Resistor().right().label('R1')
|
|
57
|
+
|
|
58
|
+
# Positioning
|
|
59
|
+
d += elm.Capacitor().down() # Go down
|
|
60
|
+
d += elm.Resistor().left() # Go left
|
|
61
|
+
d += elm.Diode().up() # Go up
|
|
62
|
+
d += elm.Resistor().right() # Go right (default)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Connections and Flow**
|
|
66
|
+
```python
|
|
67
|
+
# Schemdraw maintains current position
|
|
68
|
+
d += elm.Resistor() # From current pos, going right
|
|
69
|
+
d += elm.Capacitor().down() # From end of resistor, going down
|
|
70
|
+
d += elm.Line().left() # From end of capacitor, going left
|
|
71
|
+
|
|
72
|
+
# Return to a saved position
|
|
73
|
+
r1 = d.add(elm.Resistor())
|
|
74
|
+
d += elm.Capacitor().down()
|
|
75
|
+
d += elm.Line().to(r1.start) # Connect back to start of r1
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Labeling**
|
|
79
|
+
```python
|
|
80
|
+
# Simple label
|
|
81
|
+
d += elm.Resistor().label('1kΩ')
|
|
82
|
+
|
|
83
|
+
# Label position
|
|
84
|
+
d += elm.Resistor().label('R1', loc='top') # Above
|
|
85
|
+
d += elm.Resistor().label('1kΩ', loc='bottom') # Below
|
|
86
|
+
|
|
87
|
+
# Multiple labels
|
|
88
|
+
d += elm.Resistor().label('R1', loc='top').label('1kΩ', loc='bottom')
|
|
89
|
+
|
|
90
|
+
# Math notation
|
|
91
|
+
d += elm.Capacitor().label('$C_1$')
|
|
92
|
+
d += elm.Resistor().label('$R_{load}$')
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Common Components
|
|
96
|
+
|
|
97
|
+
**Passive Components**
|
|
98
|
+
```python
|
|
99
|
+
# Resistors
|
|
100
|
+
d += elm.Resistor()
|
|
101
|
+
d += elm.ResistorVar() # Variable resistor
|
|
102
|
+
d += elm.Potentiometer()
|
|
103
|
+
|
|
104
|
+
# Capacitors
|
|
105
|
+
d += elm.Capacitor()
|
|
106
|
+
d += elm.Capacitor().flip() # Flip polarity
|
|
107
|
+
d += elm.CapacitorVar() # Variable capacitor
|
|
108
|
+
|
|
109
|
+
# Inductors
|
|
110
|
+
d += elm.Inductor()
|
|
111
|
+
d += elm.Inductor2() # Alternative symbol
|
|
112
|
+
|
|
113
|
+
# Other passives
|
|
114
|
+
d += elm.Diode()
|
|
115
|
+
d += elm.DiodeZener()
|
|
116
|
+
d += elm.LED()
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Sources**
|
|
120
|
+
```python
|
|
121
|
+
# Voltage sources
|
|
122
|
+
d += elm.SourceV().label('V')
|
|
123
|
+
d += elm.SourceSin().label('~')
|
|
124
|
+
d += elm.SourceSquare()
|
|
125
|
+
|
|
126
|
+
# Current sources
|
|
127
|
+
d += elm.SourceI().label('I')
|
|
128
|
+
d += elm.SourceControlled().label('V_c')
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Active Components**
|
|
132
|
+
```python
|
|
133
|
+
# Transistors
|
|
134
|
+
d += elm.BjtNpn()
|
|
135
|
+
d += elm.BjtPnp()
|
|
136
|
+
d += elm.NFet()
|
|
137
|
+
d += elm.PFet()
|
|
138
|
+
|
|
139
|
+
# Op-amps
|
|
140
|
+
d += elm.Opamp()
|
|
141
|
+
|
|
142
|
+
# Integrated circuits
|
|
143
|
+
d += elm.Ic(pins=[...]) # Custom pin configuration
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Measurement and Misc**
|
|
147
|
+
```python
|
|
148
|
+
# Meters
|
|
149
|
+
d += elm.Meter().label('V')
|
|
150
|
+
d += elm.Ammeter()
|
|
151
|
+
|
|
152
|
+
# Switches
|
|
153
|
+
d += elm.Switch()
|
|
154
|
+
d += elm.SwitchDpst()
|
|
155
|
+
|
|
156
|
+
# Ground and reference
|
|
157
|
+
d += elm.Ground()
|
|
158
|
+
d += elm.GroundSignal()
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Advanced Techniques
|
|
162
|
+
|
|
163
|
+
**Precise Positioning with .at()**
|
|
164
|
+
```python
|
|
165
|
+
# Position at specific coordinate
|
|
166
|
+
d += elm.Resistor().at((2, 3))
|
|
167
|
+
|
|
168
|
+
# Position at another element
|
|
169
|
+
r1 = d.add(elm.Resistor())
|
|
170
|
+
d += elm.Capacitor().at(r1.end)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Anchor Points**
|
|
174
|
+
```python
|
|
175
|
+
# Most elements have .start, .end, .center
|
|
176
|
+
r1 = d.add(elm.Resistor())
|
|
177
|
+
d += elm.Line().at(r1.center).down()
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Angles and Rotation**
|
|
181
|
+
```python
|
|
182
|
+
# Rotate element
|
|
183
|
+
d += elm.Resistor().theta(45) # 45 degrees
|
|
184
|
+
|
|
185
|
+
# Diagonal connections
|
|
186
|
+
d += elm.Resistor().to((5, 3)) # Go to specific point
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Dot Markers for Junctions**
|
|
190
|
+
```python
|
|
191
|
+
# Add dot at junction
|
|
192
|
+
d += elm.Dot()
|
|
193
|
+
|
|
194
|
+
# Dot at element position
|
|
195
|
+
d += elm.Dot().at(r1.end)
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Styling and Color**
|
|
199
|
+
```python
|
|
200
|
+
# Color (use colorblind-safe palette)
|
|
201
|
+
d += elm.Resistor().color('#E69F00') # Okabe-Ito orange
|
|
202
|
+
|
|
203
|
+
# Line width
|
|
204
|
+
d += elm.Resistor().linewidth(2)
|
|
205
|
+
|
|
206
|
+
# Fill
|
|
207
|
+
d += elm.Capacitor().fill('#56B4E9') # Okabe-Ito blue
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Complete Example: RC Filter
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
import schemdraw
|
|
214
|
+
import schemdraw.elements as elm
|
|
215
|
+
|
|
216
|
+
# Publication styling
|
|
217
|
+
d = schemdraw.Drawing(fontsize=10, font='Arial')
|
|
218
|
+
|
|
219
|
+
# Input
|
|
220
|
+
d += elm.Dot().label('$V_{in}$', loc='left')
|
|
221
|
+
d += elm.Resistor().right().label('$R$\n1kΩ', loc='top')
|
|
222
|
+
|
|
223
|
+
# Junction
|
|
224
|
+
d += elm.Dot()
|
|
225
|
+
d.push() # Save position
|
|
226
|
+
|
|
227
|
+
# Capacitor to ground
|
|
228
|
+
d += elm.Capacitor().down().label('$C$\n10µF', loc='right')
|
|
229
|
+
d += elm.Ground()
|
|
230
|
+
|
|
231
|
+
# Output
|
|
232
|
+
d.pop() # Return to saved position
|
|
233
|
+
d += elm.Line().right()
|
|
234
|
+
d += elm.Dot().label('$V_{out}$', loc='right')
|
|
235
|
+
|
|
236
|
+
# Save
|
|
237
|
+
d.save('rc_filter.pdf')
|
|
238
|
+
d.save('rc_filter.png', dpi=300)
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Export Options
|
|
242
|
+
|
|
243
|
+
```python
|
|
244
|
+
# Vector formats (preferred)
|
|
245
|
+
d.save('diagram.svg')
|
|
246
|
+
d.save('diagram.pdf')
|
|
247
|
+
|
|
248
|
+
# Raster format
|
|
249
|
+
d.save('diagram.png', dpi=300)
|
|
250
|
+
|
|
251
|
+
# Display in Jupyter
|
|
252
|
+
d.draw()
|
|
253
|
+
|
|
254
|
+
# Get matplotlib Figure for further customization
|
|
255
|
+
fig = d.draw()
|
|
256
|
+
# Can now use matplotlib commands on fig
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## NetworkX: Network and Graph Diagrams
|
|
260
|
+
|
|
261
|
+
### Overview
|
|
262
|
+
|
|
263
|
+
NetworkX creates, analyzes, and visualizes complex networks and graphs. Ideal for collaboration networks, protein interactions, citations, and any relationship data.
|
|
264
|
+
|
|
265
|
+
**Official Documentation**: https://networkx.org/
|
|
266
|
+
|
|
267
|
+
### Basic Usage
|
|
268
|
+
|
|
269
|
+
```python
|
|
270
|
+
import networkx as nx
|
|
271
|
+
import matplotlib.pyplot as plt
|
|
272
|
+
|
|
273
|
+
# Create graph
|
|
274
|
+
G = nx.Graph()
|
|
275
|
+
|
|
276
|
+
# Add nodes and edges
|
|
277
|
+
G.add_nodes_from([1, 2, 3, 4])
|
|
278
|
+
G.add_edges_from([(1, 2), (1, 3), (2, 4), (3, 4)])
|
|
279
|
+
|
|
280
|
+
# Draw
|
|
281
|
+
nx.draw(G, with_labels=True)
|
|
282
|
+
plt.savefig('network.pdf')
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Graph Creation
|
|
286
|
+
|
|
287
|
+
**Undirected Graphs**
|
|
288
|
+
```python
|
|
289
|
+
G = nx.Graph()
|
|
290
|
+
G.add_edge('A', 'B') # Adds nodes automatically
|
|
291
|
+
G.add_edge('B', 'C')
|
|
292
|
+
G.add_edge('C', 'A')
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Directed Graphs**
|
|
296
|
+
```python
|
|
297
|
+
G = nx.DiGraph()
|
|
298
|
+
G.add_edge('Gene1', 'Protein1') # Gene1 -> Protein1
|
|
299
|
+
G.add_edge('Protein1', 'Gene2')
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**Weighted Graphs**
|
|
303
|
+
```python
|
|
304
|
+
G = nx.Graph()
|
|
305
|
+
G.add_edge('A', 'B', weight=0.5)
|
|
306
|
+
G.add_edge('B', 'C', weight=0.8)
|
|
307
|
+
G.add_edge('C', 'A', weight=0.3)
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
**From Data**
|
|
311
|
+
```python
|
|
312
|
+
import pandas as pd
|
|
313
|
+
|
|
314
|
+
# From edge list DataFrame
|
|
315
|
+
df = pd.DataFrame({
|
|
316
|
+
'source': ['A', 'B', 'C'],
|
|
317
|
+
'target': ['B', 'C', 'A'],
|
|
318
|
+
'weight': [0.5, 0.8, 0.3]
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
G = nx.from_pandas_edgelist(df, source='source', target='target',
|
|
322
|
+
edge_attr='weight')
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Layout Algorithms
|
|
326
|
+
|
|
327
|
+
**Spring Layout (Force-Directed)**
|
|
328
|
+
```python
|
|
329
|
+
pos = nx.spring_layout(G, k=0.5, iterations=50)
|
|
330
|
+
nx.draw(G, pos, with_labels=True)
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
**Circular Layout**
|
|
334
|
+
```python
|
|
335
|
+
pos = nx.circular_layout(G)
|
|
336
|
+
nx.draw(G, pos, with_labels=True)
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**Hierarchical Layout**
|
|
340
|
+
```python
|
|
341
|
+
# Requires pygraphviz
|
|
342
|
+
pos = nx.nx_agraph.graphviz_layout(G, prog='dot')
|
|
343
|
+
nx.draw(G, pos, with_labels=True)
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
**Shell Layout (Concentric)**
|
|
347
|
+
```python
|
|
348
|
+
# Define shells (groups of nodes)
|
|
349
|
+
shells = [['A', 'B'], ['C', 'D', 'E']]
|
|
350
|
+
pos = nx.shell_layout(G, nlist=shells)
|
|
351
|
+
nx.draw(G, pos, with_labels=True)
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
**Manual Positioning**
|
|
355
|
+
```python
|
|
356
|
+
pos = {
|
|
357
|
+
'A': (0, 0),
|
|
358
|
+
'B': (1, 1),
|
|
359
|
+
'C': (2, 0),
|
|
360
|
+
'D': (1, -1)
|
|
361
|
+
}
|
|
362
|
+
nx.draw(G, pos, with_labels=True)
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Styling Networks
|
|
366
|
+
|
|
367
|
+
**Node Styling**
|
|
368
|
+
```python
|
|
369
|
+
# Colorblind-safe Okabe-Ito palette
|
|
370
|
+
okabe_ito = ['#E69F00', '#56B4E9', '#009E73', '#F0E442',
|
|
371
|
+
'#0072B2', '#D55E00', '#CC79A7', '#000000']
|
|
372
|
+
|
|
373
|
+
# Color by attribute
|
|
374
|
+
node_colors = [okabe_ito[G.nodes[node]['type']] for node in G.nodes()]
|
|
375
|
+
|
|
376
|
+
# Size by degree
|
|
377
|
+
node_sizes = [300 * G.degree(node) for node in G.nodes()]
|
|
378
|
+
|
|
379
|
+
nx.draw(G, pos,
|
|
380
|
+
node_color=node_colors,
|
|
381
|
+
node_size=node_sizes,
|
|
382
|
+
with_labels=True,
|
|
383
|
+
font_size=10,
|
|
384
|
+
font_family='Arial')
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
**Edge Styling**
|
|
388
|
+
```python
|
|
389
|
+
# Edge width by weight
|
|
390
|
+
edges = G.edges()
|
|
391
|
+
weights = [G[u][v]['weight'] for u, v in edges]
|
|
392
|
+
widths = [w * 3 for w in weights] # Scale for visibility
|
|
393
|
+
|
|
394
|
+
nx.draw_networkx_edges(G, pos, width=widths, alpha=0.6,
|
|
395
|
+
edge_color='#56B4E9')
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
**Labels**
|
|
399
|
+
```python
|
|
400
|
+
# Node labels
|
|
401
|
+
nx.draw_networkx_labels(G, pos, font_size=10, font_family='Arial')
|
|
402
|
+
|
|
403
|
+
# Edge labels
|
|
404
|
+
edge_labels = nx.get_edge_attributes(G, 'weight')
|
|
405
|
+
nx.draw_networkx_edge_labels(G, pos, edge_labels, font_size=8)
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### Publication-Quality Network Diagram
|
|
409
|
+
|
|
410
|
+
```python
|
|
411
|
+
import networkx as nx
|
|
412
|
+
import matplotlib.pyplot as plt
|
|
413
|
+
|
|
414
|
+
# Create graph
|
|
415
|
+
G = nx.Graph()
|
|
416
|
+
G.add_edges_from([
|
|
417
|
+
('A', 'B', {'weight': 0.8}),
|
|
418
|
+
('A', 'C', {'weight': 0.5}),
|
|
419
|
+
('B', 'D', {'weight': 0.7}),
|
|
420
|
+
('C', 'D', {'weight': 0.6}),
|
|
421
|
+
])
|
|
422
|
+
|
|
423
|
+
# Layout
|
|
424
|
+
pos = nx.spring_layout(G, k=1, iterations=50, seed=42)
|
|
425
|
+
|
|
426
|
+
# Create figure
|
|
427
|
+
fig, ax = plt.subplots(figsize=(6, 6))
|
|
428
|
+
|
|
429
|
+
# Okabe-Ito colors
|
|
430
|
+
colors = ['#E69F00', '#56B4E9', '#009E73', '#F0E442']
|
|
431
|
+
node_colors = {node: colors[i] for i, node in enumerate(G.nodes())}
|
|
432
|
+
|
|
433
|
+
# Draw edges
|
|
434
|
+
edges = G.edges()
|
|
435
|
+
weights = [G[u][v]['weight'] for u, v in edges]
|
|
436
|
+
nx.draw_networkx_edges(G, pos, width=[w*5 for w in weights],
|
|
437
|
+
alpha=0.5, edge_color='#666666', ax=ax)
|
|
438
|
+
|
|
439
|
+
# Draw nodes
|
|
440
|
+
nx.draw_networkx_nodes(G, pos,
|
|
441
|
+
node_color=[node_colors[n] for n in G.nodes()],
|
|
442
|
+
node_size=800,
|
|
443
|
+
edgecolors='black',
|
|
444
|
+
linewidths=2,
|
|
445
|
+
ax=ax)
|
|
446
|
+
|
|
447
|
+
# Draw labels
|
|
448
|
+
nx.draw_networkx_labels(G, pos, font_size=12, font_family='Arial',
|
|
449
|
+
font_weight='bold', ax=ax)
|
|
450
|
+
|
|
451
|
+
# Formatting
|
|
452
|
+
ax.set_xlim(-1.2, 1.2)
|
|
453
|
+
ax.set_ylim(-1.2, 1.2)
|
|
454
|
+
ax.axis('off')
|
|
455
|
+
|
|
456
|
+
plt.tight_layout()
|
|
457
|
+
plt.savefig('network.pdf', bbox_inches='tight')
|
|
458
|
+
plt.savefig('network.png', dpi=300, bbox_inches='tight')
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
## Matplotlib Patches: Custom Diagrams
|
|
462
|
+
|
|
463
|
+
### Overview
|
|
464
|
+
|
|
465
|
+
Matplotlib's patches module provides geometric shapes for building custom diagrams: rectangles, circles, arrows, polygons. Perfect for biological pathways, custom flowcharts, and conceptual diagrams.
|
|
466
|
+
|
|
467
|
+
### Basic Shapes
|
|
468
|
+
|
|
469
|
+
**Rectangle**
|
|
470
|
+
```python
|
|
471
|
+
import matplotlib.pyplot as plt
|
|
472
|
+
import matplotlib.patches as mpatches
|
|
473
|
+
|
|
474
|
+
fig, ax = plt.subplots(figsize=(8, 6))
|
|
475
|
+
|
|
476
|
+
# Create rectangle: (x, y, width, height)
|
|
477
|
+
rect = mpatches.Rectangle((0.2, 0.5), 0.3, 0.2,
|
|
478
|
+
facecolor='#56B4E9',
|
|
479
|
+
edgecolor='black',
|
|
480
|
+
linewidth=2)
|
|
481
|
+
ax.add_patch(rect)
|
|
482
|
+
|
|
483
|
+
# Add text
|
|
484
|
+
ax.text(0.35, 0.6, 'Process', ha='center', va='center',
|
|
485
|
+
fontsize=12, fontweight='bold')
|
|
486
|
+
|
|
487
|
+
ax.set_xlim(0, 1)
|
|
488
|
+
ax.set_ylim(0, 1)
|
|
489
|
+
ax.axis('off')
|
|
490
|
+
plt.show()
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
**Circle**
|
|
494
|
+
```python
|
|
495
|
+
# Circle: (center_x, center_y), radius
|
|
496
|
+
circle = mpatches.Circle((0.5, 0.5), 0.1,
|
|
497
|
+
facecolor='#E69F00',
|
|
498
|
+
edgecolor='black',
|
|
499
|
+
linewidth=2)
|
|
500
|
+
ax.add_patch(circle)
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
**Ellipse**
|
|
504
|
+
```python
|
|
505
|
+
# Ellipse: (center_x, center_y), width, height
|
|
506
|
+
ellipse = mpatches.Ellipse((0.5, 0.5), 0.3, 0.2,
|
|
507
|
+
facecolor='#009E73',
|
|
508
|
+
edgecolor='black',
|
|
509
|
+
linewidth=2)
|
|
510
|
+
ax.add_patch(ellipse)
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
**Polygon**
|
|
514
|
+
```python
|
|
515
|
+
# Polygon: list of (x, y) coordinates
|
|
516
|
+
triangle = mpatches.Polygon([(0.3, 0.2), (0.7, 0.2), (0.5, 0.6)],
|
|
517
|
+
facecolor='#F0E442',
|
|
518
|
+
edgecolor='black',
|
|
519
|
+
linewidth=2)
|
|
520
|
+
ax.add_patch(triangle)
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
**Rounded Rectangle (FancyBboxPatch)**
|
|
524
|
+
```python
|
|
525
|
+
from matplotlib.patches import FancyBboxPatch
|
|
526
|
+
|
|
527
|
+
rounded_rect = FancyBboxPatch((0.2, 0.5), 0.3, 0.2,
|
|
528
|
+
boxstyle="round,pad=0.02",
|
|
529
|
+
facecolor='#0072B2',
|
|
530
|
+
edgecolor='black',
|
|
531
|
+
linewidth=2)
|
|
532
|
+
ax.add_patch(rounded_rect)
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
### Arrows and Connections
|
|
536
|
+
|
|
537
|
+
**FancyArrowPatch**
|
|
538
|
+
```python
|
|
539
|
+
from matplotlib.patches import FancyArrowPatch
|
|
540
|
+
|
|
541
|
+
# Arrow from (x1, y1) to (x2, y2)
|
|
542
|
+
arrow = FancyArrowPatch((0.2, 0.5), (0.7, 0.5),
|
|
543
|
+
arrowstyle='->',
|
|
544
|
+
mutation_scale=20,
|
|
545
|
+
linewidth=2,
|
|
546
|
+
color='black')
|
|
547
|
+
ax.add_patch(arrow)
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
**Arrow Styles**
|
|
551
|
+
```python
|
|
552
|
+
# Different arrow styles
|
|
553
|
+
'->' # Standard arrow
|
|
554
|
+
'->>' # Double arrow
|
|
555
|
+
'-|>' # Fancy arrow
|
|
556
|
+
'<->' # Double-headed
|
|
557
|
+
'-[' # Bracket
|
|
558
|
+
'|-|' # Bar-bar
|
|
559
|
+
'fancy' # Fancy, customizable
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
**Curved Arrows**
|
|
563
|
+
```python
|
|
564
|
+
# Curved connection
|
|
565
|
+
arrow = FancyArrowPatch((0.2, 0.5), (0.7, 0.8),
|
|
566
|
+
arrowstyle='->',
|
|
567
|
+
connectionstyle="arc3,rad=0.3", # Curvature
|
|
568
|
+
mutation_scale=20,
|
|
569
|
+
linewidth=2,
|
|
570
|
+
color='black')
|
|
571
|
+
ax.add_patch(arrow)
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
### Biological Pathway Example
|
|
575
|
+
|
|
576
|
+
```python
|
|
577
|
+
import matplotlib.pyplot as plt
|
|
578
|
+
import matplotlib.patches as mpatches
|
|
579
|
+
from matplotlib.patches import FancyBboxPatch, FancyArrowPatch
|
|
580
|
+
|
|
581
|
+
# Okabe-Ito palette
|
|
582
|
+
colors = {
|
|
583
|
+
'protein': '#56B4E9',
|
|
584
|
+
'gene': '#009E73',
|
|
585
|
+
'metabolite': '#F0E442'
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
fig, ax = plt.subplots(figsize=(10, 6))
|
|
589
|
+
|
|
590
|
+
# Define proteins
|
|
591
|
+
proteins = [
|
|
592
|
+
('Receptor', 1, 4, 'protein'),
|
|
593
|
+
('Kinase A', 3, 4, 'protein'),
|
|
594
|
+
('Kinase B', 5, 4, 'protein'),
|
|
595
|
+
('TF', 7, 4, 'protein'),
|
|
596
|
+
('Gene', 7, 2, 'gene')
|
|
597
|
+
]
|
|
598
|
+
|
|
599
|
+
# Draw proteins/genes
|
|
600
|
+
for name, x, y, ptype in proteins:
|
|
601
|
+
if ptype == 'gene':
|
|
602
|
+
# Genes as rectangles
|
|
603
|
+
box = mpatches.Rectangle((x-0.4, y-0.25), 0.8, 0.5,
|
|
604
|
+
facecolor=colors[ptype],
|
|
605
|
+
edgecolor='black',
|
|
606
|
+
linewidth=2)
|
|
607
|
+
else:
|
|
608
|
+
# Proteins as rounded rectangles
|
|
609
|
+
box = FancyBboxPatch((x-0.4, y-0.25), 0.8, 0.5,
|
|
610
|
+
boxstyle="round,pad=0.05",
|
|
611
|
+
facecolor=colors[ptype],
|
|
612
|
+
edgecolor='black',
|
|
613
|
+
linewidth=2)
|
|
614
|
+
ax.add_patch(box)
|
|
615
|
+
ax.text(x, y, name, ha='center', va='center',
|
|
616
|
+
fontsize=10, fontweight='bold', fontfamily='Arial')
|
|
617
|
+
|
|
618
|
+
# Activation arrows
|
|
619
|
+
activations = [
|
|
620
|
+
(1.5, 4, 2.5, 4), # Receptor -> Kinase A
|
|
621
|
+
(3.5, 4, 4.5, 4), # Kinase A -> Kinase B
|
|
622
|
+
(5.5, 4, 6.5, 4), # Kinase B -> TF
|
|
623
|
+
(7, 3.75, 7, 2.6) # TF -> Gene
|
|
624
|
+
]
|
|
625
|
+
|
|
626
|
+
for x1, y1, x2, y2 in activations:
|
|
627
|
+
arrow = FancyArrowPatch((x1, y1), (x2, y2),
|
|
628
|
+
arrowstyle='->', mutation_scale=20,
|
|
629
|
+
linewidth=2.5, color='black')
|
|
630
|
+
ax.add_patch(arrow)
|
|
631
|
+
|
|
632
|
+
# Format
|
|
633
|
+
ax.set_xlim(0, 8.5)
|
|
634
|
+
ax.set_ylim(1, 5)
|
|
635
|
+
ax.set_aspect('equal')
|
|
636
|
+
ax.axis('off')
|
|
637
|
+
|
|
638
|
+
plt.tight_layout()
|
|
639
|
+
plt.savefig('signaling_pathway.pdf', bbox_inches='tight')
|
|
640
|
+
plt.savefig('signaling_pathway.png', dpi=300, bbox_inches='tight')
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
## Integrating with LaTeX
|
|
644
|
+
|
|
645
|
+
### Matplotlib LaTeX Rendering
|
|
646
|
+
|
|
647
|
+
```python
|
|
648
|
+
import matplotlib.pyplot as plt
|
|
649
|
+
|
|
650
|
+
# Enable LaTeX text rendering
|
|
651
|
+
plt.rcParams['text.usetex'] = True
|
|
652
|
+
plt.rcParams['font.family'] = 'serif'
|
|
653
|
+
plt.rcParams['font.size'] = 10
|
|
654
|
+
|
|
655
|
+
# Use LaTeX in labels
|
|
656
|
+
ax.text(0.5, 0.5, r'$\alpha + \beta = \gamma$', fontsize=12)
|
|
657
|
+
ax.set_xlabel(r'Time $t$ (seconds)')
|
|
658
|
+
ax.set_ylabel(r'$\Delta$ Temperature ($^\circ$C)')
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
### PGF Backend for Perfect LaTeX Integration
|
|
662
|
+
|
|
663
|
+
```python
|
|
664
|
+
import matplotlib
|
|
665
|
+
matplotlib.use('pgf')
|
|
666
|
+
import matplotlib.pyplot as plt
|
|
667
|
+
|
|
668
|
+
# Configure PGF
|
|
669
|
+
plt.rcParams.update({
|
|
670
|
+
'pgf.texsystem': 'pdflatex',
|
|
671
|
+
'font.family': 'serif',
|
|
672
|
+
'text.usetex': True,
|
|
673
|
+
'pgf.rcfonts': False,
|
|
674
|
+
})
|
|
675
|
+
|
|
676
|
+
# Create figure
|
|
677
|
+
fig, ax = plt.subplots()
|
|
678
|
+
# ... plotting code ...
|
|
679
|
+
|
|
680
|
+
# Save as PGF (can be included in LaTeX)
|
|
681
|
+
plt.savefig('diagram.pgf')
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
Then in LaTeX:
|
|
685
|
+
```latex
|
|
686
|
+
\begin{figure}
|
|
687
|
+
\centering
|
|
688
|
+
\input{diagram.pgf}
|
|
689
|
+
\caption{My diagram}
|
|
690
|
+
\end{figure}
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
## Best Practices
|
|
694
|
+
|
|
695
|
+
### 1. Colorblind-Safe Palettes
|
|
696
|
+
|
|
697
|
+
```python
|
|
698
|
+
# Okabe-Ito palette (use this!)
|
|
699
|
+
OKABE_ITO = {
|
|
700
|
+
'orange': '#E69F00',
|
|
701
|
+
'sky_blue': '#56B4E9',
|
|
702
|
+
'green': '#009E73',
|
|
703
|
+
'yellow': '#F0E442',
|
|
704
|
+
'blue': '#0072B2',
|
|
705
|
+
'vermillion': '#D55E00',
|
|
706
|
+
'purple': '#CC79A7',
|
|
707
|
+
'black': '#000000'
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
# Use in diagrams
|
|
711
|
+
node_color = OKABE_ITO['blue']
|
|
712
|
+
edge_color = OKABE_ITO['orange']
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
### 2. Publication-Quality Settings
|
|
716
|
+
|
|
717
|
+
```python
|
|
718
|
+
import matplotlib.pyplot as plt
|
|
719
|
+
|
|
720
|
+
# Set publication defaults
|
|
721
|
+
plt.rcParams['font.family'] = 'sans-serif'
|
|
722
|
+
plt.rcParams['font.sans-serif'] = ['Arial', 'Helvetica']
|
|
723
|
+
plt.rcParams['font.size'] = 8
|
|
724
|
+
plt.rcParams['axes.linewidth'] = 0.8
|
|
725
|
+
plt.rcParams['pdf.fonttype'] = 42 # TrueType fonts in PDF
|
|
726
|
+
plt.rcParams['ps.fonttype'] = 42
|
|
727
|
+
|
|
728
|
+
# Save with proper settings
|
|
729
|
+
fig.savefig('diagram.pdf', dpi=300, bbox_inches='tight',
|
|
730
|
+
pad_inches=0.05, transparent=False)
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
### 3. Consistent Sizing
|
|
734
|
+
|
|
735
|
+
```python
|
|
736
|
+
# Design at final size
|
|
737
|
+
# Single column: 3.5 inches
|
|
738
|
+
# Double column: 7.0 inches
|
|
739
|
+
|
|
740
|
+
fig, ax = plt.subplots(figsize=(3.5, 2.5)) # Single column
|
|
741
|
+
# or
|
|
742
|
+
fig, ax = plt.subplots(figsize=(7.0, 4.0)) # Double column
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
### 4. Vector Output
|
|
746
|
+
|
|
747
|
+
```python
|
|
748
|
+
# Always prefer vector formats
|
|
749
|
+
d.save('circuit.pdf') # Schemdraw
|
|
750
|
+
plt.savefig('network.svg') # NetworkX/Matplotlib
|
|
751
|
+
|
|
752
|
+
# Raster only as fallback
|
|
753
|
+
plt.savefig('diagram.png', dpi=300)
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
## Troubleshooting
|
|
757
|
+
|
|
758
|
+
**Issue**: Fonts not embedded in PDF
|
|
759
|
+
```python
|
|
760
|
+
# Solution: Set fonttype to TrueType
|
|
761
|
+
plt.rcParams['pdf.fonttype'] = 42
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
**Issue**: Text appears pixelated
|
|
765
|
+
```python
|
|
766
|
+
# Solution: Use vector format or higher DPI
|
|
767
|
+
plt.savefig('fig.png', dpi=300) # or use PDF
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
**Issue**: NetworkX layout looks messy
|
|
771
|
+
```python
|
|
772
|
+
# Solution: Try different layouts or manual positioning
|
|
773
|
+
pos = nx.spring_layout(G, k=2, iterations=100, seed=42)
|
|
774
|
+
# Increase k for more spacing, set seed for reproducibility
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
**Issue**: Schemdraw elements not connecting
|
|
778
|
+
```python
|
|
779
|
+
# Solution: Use .to() or .at() for precise positioning
|
|
780
|
+
d += elm.Line().to(other_element.end)
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
## Further Resources
|
|
784
|
+
|
|
785
|
+
- **Schemdraw**: https://schemdraw.readthedocs.io/
|
|
786
|
+
- **NetworkX**: https://networkx.org/documentation/
|
|
787
|
+
- **Matplotlib**: https://matplotlib.org/stable/api/patches_api.html
|
|
788
|
+
- **Python Graph Gallery**: https://python-graph-gallery.com/
|
|
789
|
+
|
|
790
|
+
These Python libraries provide powerful tools for creating publication-quality scientific diagrams programmatically, enabling reproducible, data-driven visualizations.
|
|
791
|
+
|